.NET Assembly Versions with BuildMaster

.NET assemblies include a variety of metadata, most of which are typically defined in code in a file like AssemblyInfo.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 Write Assembly Versions Action

The easiest way to update your AssemblyInfo files is to use the Write Assembly Version Attributes Action. All you have to do is add this action to your deployment plan after getting your source code, and you should be good to go! If you want to use something other than $ReleaseNumber.$BuildNumber, just change the default values.

Using the Search/Replace File Contents Action

If you need to change more attributes or perform a more advanced replacement, use the Search/Replace File Contents Action. This action willl allow you to replace text in your files using either a simple substring search or a regular expression.