Updating the assembly version
The Assembly Info file contains all of the metadata about the assembly which is included when it is built.I just use a MSBuild community task to rewrite my complete Assembly file with all of the required information. Engine Properties Assembly Info.cs” Assembly Title=”DLRHost. Engine” Assembly Description=”DLRHost Engine” Assembly Configuration=”” Assembly Company=”Ben Hall – Blog.To provide feedback on individual help topics, use the “Feedback on this topic” link on the individual topic page.
To have reusable code I’ve create a script called Build Functions.psm1 that contains all functions that can be useful during the build.
As it happens, Team City provides this number within an environment variable BUILD_NUMBER which we can use within our build script via the $() syntax, the code below takes the number from Team City and puts it inside another variable called Version.
I then need to update my Assembly file with this build number.
The counter contains the value which will be used for the next build.
We now have our build number in the format we want (in this case 184.108.40.206), but we need to be able to access this when the application is being built.
When being applications, ideally you want your assemblies to be labelled with the associated build.