Adding Assembly Versioning to VSTS Build

Christopher Woolum by Christopher Woolum
August 8, 2016

Over the past few months, we have been refining and adding functionality to our On-Premises release toolkit. One of the newer requests we had was the ability to provide versioning to assemblies. This was important because we needed to be able to easily correlate a bug to a specific build. To accomplish this goal we added a new task to our toolkit that sets the version in all of the AssemblyInfo.cs files in your project. Here are the steps to add this to your own project.

  1. Make sure you have added out On-Premise Release toolkit to your instance of VSTS from here
  2. In order to easily correlate builds to Assembly Versions, you will want to change the build number format of your build to $(Year:yy)$(DayOfYear)$(rev:.r) . Unfortunately, C# limits build numbers to be limited to below 65535 which is why we are using the Julian Date.generalbuild
  3. Add the new ‘Set Assembly Version’ task to your build. You will want this to be the first task to run in your build. Set the version number to something meaningful to you. Setting it to 1.0.$(Build.BuildNumber) will use the build number you set on the general page.addtask

The drop that come from your build should now be versioned! If you want to show this in your UI, You can add this to your Razor or Asp.Net View. like so:


This task should be available to everyone that has added our extension. Please let us know any of your feedback on our Github page or contact us if you are interested in having Technossus Automate your Release Management Process