views:

1579

answers:

4

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

A: 

I always have it checked in. In fact I believe this is the default behavior with Team System Source Control.

Robert Kozak
I am using Subversion and CrusieControl.NET. I build using a NAnt script. All I have read is that AssemblyInfo.cs is an output generated during the build process. So the build sequence is :-CCNET (SVN Trigger by a check-in @say repository version 100)NAnt calledmsbuild calledassemblyinfo.cs is created afgter the buildDo I now check-in assemblyInfo.cs? If checked-in the repository would then be at Rev 101. So my aim of having AssemblyInfo.cs matching the build revision is not met. How do I do this?
Liam Donaldson
+4  A: 

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).

skolima
+4  A: 

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.

Ryu
A: 

We have a MSBuild script that generates all the needed AssemblyInfo.cs files prior to the build. This way I can also use the SVN revision number in the assembly versions. The AssemblyInfo.cs files are not checked into SVN (they're ignored so that they don't bother people) but generated prior to building (doesn't matter whether it an automated build script or from VS).

I also supply a batch file to take care of the AssemblyInfo.cs files generation so that the developers don't need to bother with the details.

jl