Wednesday, January 22, 2014

Auto-increment build numbers in Visual Studio

Future reference for me

http://bloggingabout.net/blogs/vagif/archive/2010/04/24/using-t4-templates-to-manage-assembly-version-information.aspx

Drop a TT file in the VS project
<#@ template language="C#" #>
//
// This code was generated by a tool. Any changes made manually will be lost
// the next time this code is regenerated.
//

using System.Reflection;

[assembly: AssemblyVersion("<#= this.Major #>.<#= this.Minor #>.<#= this.RevisionNumber #>.*")]
<#+
int Major = 1;
int Minor = 0;
    int RevisionNumber = (int)((DateTime.UtcNow - new DateTime(2013, 11, 22)).TotalDays);
#>

This will update the AssemblyVersion to 1.0.(Number of Days since 11/22/2013).(the last part is the autoincrementer already in there)



No comments:

Post a Comment

There was an error in this gadget