/ Published in: C#
T4 template for put the date in build number (without year)
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<#@ template debug="false" hostspecific="true" language="C#" #> <#@ import namespace="System.IO" #> <#@ output extension=".cs" #> <# int major = 1; int minor = 115; string build = ""; string revision = ""; string error = ""; DateTime now = DateTime.Now; try { using(var f = File.OpenText(Host.ResolvePath("AssemblyVersion.cs"))) { build = now.ToString("MMd"); revision = now.ToString("HHmm"); } } catch (Exception e) { error = e.ToString(); build = "0"; revision = "0"; } #> // // This code was generated by a tool. Any changes made manually will be lost // the next time this code is regenerated. // /* <#= error #> */ using System.Reflection; [assembly: AssemblyVersion("<#= major #>.<#= minor #>.<#= build #>.<#= revision #>")] //[assembly: AssemblyFileVersion("<#= major #>.<#= minor #>.<#= build #>.<#= revision #>")]