.NET Assembly Versions with BuildMaster

.NET assemblies include a variety of metadata, most of which are typically defined in code in a file likeAssemblyInfo.cs. When compiled, this metadata will be embedded in the resulting assembly. This article concerns two attributes typically placed in AssemblyInfo.cs:

[assembly: AssemblyVersion("0.0.0.0")]
[assembly: AssemblyFileVersion("0.0")]

Ideally, when you build and deploy to your first environment, these attributes would automatically get updated with the appropriate build and release numbers. Fortunately, this is trivial to do with BuildMaster.

Using the Search/Replace File Contents Action

To easily tag your assemblies with the correct version information, just add a Search/Replace File Contents action after you get the source from source control, but before you build anything:

Replace Text Action

Then, simply replace the existing Version… strings with BuildMaster’s release and buildvariable values:

Search Replace Action

This simple technique will allow you to very easily ensure that your assemblies are properly versioned as part of your build process.

Last modified: 5/10/2012

This content has the following tags:

buildmaster.netassembly