How to setting-up visual studio 2010 to set as auto-increment version of project on each build?
Does this feature exist on vs2010
?
By default, Visual Studio automatically increments the Revision number of the Publish Version each time you publish the application. You can disable this behavior on the Publish page of the Project Designer.
AssemblyVersion: Specifies the version of the assembly being attributed. AssemblyFileVersion: Instructs a compiler to use a specific version number for the Win32 file version resource.
Change the AssemblyInfo.cs-File:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
to
[assembly: AssemblyVersion("1.0.*")]
//[assembly: AssemblyFileVersion("1.0.0.0")]
As someone else mentions the 1.0.* is always replaced with 1.0.{date}.{time] so it should be always be increment (you would have thought)
In VS2010 changing the AssemblyVersion to [assembly: AssemblyVersion("1.0.*")] works, be warned that you must close the solution/project, re-open it then re-build it (not build) to refresh/change the build+revision values.
The date/time appears to be obtained from the time the project is opened thus the close/re-open to refresh the revision/build values, I guess this is useful if you are changing various bits within the project in one go and it won't keep changing the AssemblyVersion possibly breaking other bits.
To return the date from the build value:
DateAdd(DateInterval.Day, build, DateValue("01/01/2000"))
' build is the number of days from 1/1/2000
To return the time from the revision value:
Date.FromOADate(revision / 1800 / 24)
' depending on your timezone you may have DST/BST issue with resulting time
The AssemblyInfo.cs - file doesnt exist if you're deveolping native software with c/c++ ... hence this answer is useless for a whole lot of developers out there - one could have a look into http://autobuildversion.codeplex.com ... but this extension doesnt seem to work with VS2010 although the website says otherwise - you may be good to go if you're using older versions of VS, though
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With