What is the best practice for updating .NET assembly versions?

We have an msbuild task that updates the AssemblyInfo.cs files so that the .NET Assembly version will match the continuous integration version (by using the build_number property).

Some products want to update the file and not check it into VCS.

Other products want to update the file and check it into VCS.

What do you recommend and why?  Do you have a standard for your .NET products (Resharper, dotTrace)?

By the way, this is a common question and issue that every .NET team I install TeamCity with has.  It would be nice to tell them that TeamCity automatically handles this, but I can't.  If you want to increase your .NET support, an easy way to handle this should be among the first features you implement.

3 comments
Comment actions Permalink

Here's my answer.  I choose to not check the files into VCS because that ensures that I am not accidentally deploying a build from a developer's machine onto production.  On the flip side, if someone wanted to pull the source from that build and they needed to debug something and the assembly version mattered with what they were doing (like with COM interop), they would have to update the AssemblyInfo.cs files.  I think it's better that they do this manually, knowing that they are going outside of the process, rather than have it sitting there ready to be deployed under that version.

0
Comment actions Permalink

We use an msbuild/NAnt script that generates temporary AssemblyInfo.cs file for every project.
All our projects in a solution references the same temporary AssemblyInfo.cs file.

I've just created an issue to make TeamCity generate that file. What do you think of it?
Could you please watch/vote for it at http://www.jetbrains.net/tracker/issue/TW-6637

Thanks!

0
Comment actions Permalink

That would work but you would run into a couple of issues:
1) Would you allow the user to include every attribute that is usually found in AssemblyInfo.cs?  (for example, AssemblyDescription)
2) Would you modify the project and add that file in?

I think a better solution might be to search for AssemblyVersionAttribute usages and update that value to whatever is in TeamCity.  That way the user can put the file wherever he wants and all you do is edit it.

One more thing: before you edit it you'll probably want to make the file writable because it just came from source control and is probably readonly.

Michael

0

Please sign in to leave a comment.