Click here to Skip to main content
6,818,958 members and growing! (20,410 online)
Email Password   helpLost your password?
Languages » C# » Utilities     Intermediate License: The Code Project Open License (CPOL)

Versioner: An AssemblyInfo version incrementer

By PIEBALDconsult

A simple C# program that will increment the AssemblyVersion attribute of an AssemblyInfo.cs file.
C#, Windows, .NET2.0VS2005, Dev
Posted:9 Jun 2006
Views:19,149
Bookmarked:7 times
printPrint   add Share
      Discuss Discuss   Broken Article?Report  
7 votes for this article.
Popularity: 2.39 Rating: 2.83 out of 5
4 votes, 57.1%
1

2

3

4
3 votes, 42.9%
5

Introduction

AssemblyVersion attributes of AssemblyInfo.cs files look something like these:

[assembly: System.Reflection.AssemblyVersion("1.0.0.0")]
[assembly: System.Reflection.AssemblyVersion("1.0.0.*")]
[assembly: System.Reflection.AssemblyVersion("1.0.*.*")]

The asterisks in the second and third examples will cause the compiler to set those two fields, but the values used may not be very useful. If you want useful values, you need to use the first example and set them yourself, but that can be a bit tedious.

This little program of mine will find an AssemblyVersion attribute in the specified file (if one exists) and attempt to increment its fourth field by one. You will still need to set the other fields manually, but that's just the nature of the beast.

Using the code

Compile Versioner.cs with your choice of C# compiler.

To run it, use:

Versioner AssemblyInfo.cs

Such a command may be added to a Visual Studio project as a "Pre-build event", this will cause the version to be incremented automatically when the project gets built.

History

  • First uploaded - 2006/06/09.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

PIEBALDconsult


Member
BSCS 1992 Wentworth Institute of Technology

Originally from the Boston (MA) area. Lived in SoCal for a while. Now in the Phoenix (AZ) area.

OpenVMS enthusiast, ISO 8601 evangelist, photographer, opinionated SOB

---------------

"Typing is no substitute for thinking." -- R.W. Hamming

"I find it appalling that you can become a programmer with less training than it takes to become a plumber." -- Bjarne Stroustrup

ZagNut’s Law: Arrogance is inversely proportional to ability.

"Well blow me sideways with a plastic marionette. I've just learned something new - and if I could award you a 100 for that post I would. Way to go you keyboard lovegod you." -- Pete O'Hanlon

"Things would be different if I ran the zoo." -- Dr. Seuss

"Wrong is evil, and it must be defeated." – Jeff Ello

"A good designer must rely on experience, on precise, logical thinking, and on pedantic exactness." -- Nigel Shaw


"Omit needless local variables." -- Strunk... had he taught programming

"DON'T BE LIBERAL IN WHAT YOU ACCEPT!"

"Software Engineers don't have Trophy Wives; they have Presentation Layers."

"We learn more from our mistakes than we do from getting it right the first time."

"I'm an old dog and I like old tricks."

"Sometimes the envelope pushes back and sometimes you get a really nasty paper cut."

"A method shall have one and only one return statement."

My first rule of debugging: "If you get a different error message, you're making progress."

My golden rule of database management: "Do not unto others' databases as you would not have done unto yours."

My general rule of software development: "Design should be top-down, but implementation should be bottom-up."

"Today's heresy is tomorrow's dogma."
or
"Today's dogma is yesterday's heresy."

"The registry is evil."

"Every tool is a hammer."
Occupation: Software Developer (Senior)
Location: United States United States

Other popular C# articles:

Article Top
You must Sign In to use this message board.
FAQ FAQ 
 
Noise Tolerance  Layout  Per page   
 Msgs 1 to 10 of 10 (Total in Forum: 10) (Refresh)FirstPrevNext
GeneralChanging AssemblyInfo.cs does not work in VS 2008 PinmemberMember 14201064:06 11 Mar '08  
GeneralRe: Changing AssemblyInfo.cs does not work in VS 2008 PinmemberPIEBALDconsult6:27 16 Mar '08  
QuestionWorksaver.... Pinmemberfelix at home21:45 12 Sep '06  
GeneralRe: Worksaver.... PinmemberPIEBALDconsult6:47 14 Sep '06  
GeneralDon't get it PinmemberDustin Metzgar11:21 9 Jun '06  
GeneralRe: Don't get it PinmemberPIEBALDconsult18:05 7 Jul '06  
GeneralGood idea PinmemberTommi G11:04 9 Jun '06  
GeneralRe: Good idea PinmemberM.Lansdaal11:31 9 Jun '06  
GeneralRe: Good idea PinmemberPIEBALDconsult18:08 7 Jul '06  
GeneralRe: Good idea PinmemberPIEBALDconsult18:07 7 Jul '06  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads.

PermaLink | Privacy | Terms of Use
Last Updated: 9 Jun 2006
Editor: Smitha Vijayan
Copyright 2006 by PIEBALDconsult
Everything else Copyright © CodeProject, 1999-2010
Web22 | Advertise on the Code Project