Is it possible to update the version number(AssemblyVersion("1.0.2.1")) insdie AssemblyInfo.cs outside visual studio???(Maybe using a script or a batch file)
I used to have a PowerShell script that would write the version number out to "AssemblyVersion.cs", like this:
// DO NOT EDIT // Generated by UpdateVersion.ps1.
[AssemblyVersion("1.0.2.1")]
The version number was updated in all projects/assemblies at once this way. The canonical number was stored elsewhere.
It's trivial to write, but varies depending on your exact needs, so I won't try to post it here.
You can simply use any search and replace tool or write one yourself.
For the current porject (that is built with msbuild) I'm using a custom build step (self written as it is small and simple) that searches for AssemblyVersion and replaces that in the AssemblyInfo.cs files.
I have used UpdateVersion in the past to update the version number as part of a build script before. If you use subversion you can also use SubWCRev.exe from TortoiseSVN to update the version number to include the SVN revision number.
It can also be done from MSBuild..
Check out the AssemblyInfo task here: MSBuild tasks
We use it from CruiseControl.net it's very straightforward to use.