Learned this from Jeremy Miller’s StroyTeller, he really is a god-father in DotNet Community.
First, create a commonAssembly.cs cotains AssemblyVersionAttribute, copyrighte, company information and put it in solution folder.
Second, add this file as a ‘link’ to each project, remove or comment out the old AssemblyInfo.cs. At least I comment out the AssemblyFileVersion attribute, so it automatically take the version from AssemblyVersion.
Third, inside your cruise.build, creata a version task by dynamically get CCNetLable from cruisecontrol then generate the correct CommonAssemblyInfo.cs.
Build. You get the consistent version number in both source-code repository and exe/dll!
I got the famous “Assembly XX.dll must be strong signed in order to be marked as a prerequisite” problem after this change. The easy solution is, manually clean up bin and obj folder. Thanks to this post. I should have try this first.
To get exe version info in CSharp
Assembly.GetExecutingAssembly().GetName().Version.ToString()
Or:
Assembly.GetEntryAssembly().GetName().Version.ToString()
Orcascript support setting version as well, I will post how-to later. Maybe with EAServer deploy tricks.