I have an automated build system using CruiseControl. I am using the SvnRevisionLabeller to to get the version string to use. With this string I can use nant to update AssemblyInfo.cs so when I build it has the correct build string. I can also use this CC label to tag the subversion repository.
So everything is aligned
- CCNet Build label
- Executable (Assembly Information)
- Version Control (subverson tag)
Now where I have a problem is if I want to try to rebuild an old image from the repository. Since AssemblyInfo.cs is not under version control but rather a generated file, when I now try to build, the versioning information will not be the same as it was when this version of the repository was built using CruiseControl. I would like to be able to generate exactly the same image regardless of whether it was built during the CC build or at a later date when checking out from Subversion.
I know that it is often not recommended, but should I check-in the assemblyInfo.cs file after each build so that when I build subsequently from a svn check-out the correct version information will be used?
Thanks, Liam
Either don't version AssemblyInfo.cs at all, or put "developer version" of them into the repository and have CruiseControl.Net svn-revert them after build (I do the later so that builds made on developers workstations are easily extinguishable from the "official" ones downloaded from CruiseControl.Net).
As for reproducing the same build labels later - you already have to do the rebuild by calling MSBuild / NAnt by hand, simply pass to it CCNetLabel set to appropriate value and you'll get the same assembly versions generated as with the build invoked from CruiseControl.Net (MSBuild: /p:CCNetLabel=1.4.2.333
, NAnt: -D:CCNetLabel=1.4.2.333
).
I use a CommonAssemblyInfo.cs file which I add a link to in every project.
The only attribute I have in this file is AssemblyFileVersion and have CC.Net / Msbuild update the version every build.
Make sure any project that includes CommonAssemblyInfo.cs doesn't have duplicate attributes in AssemblyInfo.cs.
If you check out the CC.Net source code you'll see that is how they have they're build configured.
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