I'm looking for a way of creating a dynamic Assembly Version for my ASP.NET MVC5 solution so that it would follow the format:
YYYY.M.D.XXXXX
For example:
2014.7.25.45261
Ideally I would like to do the following in AssemblyInfo.cs
:
DateTime dt = DateTime.Today;
[assembly: AssemblyVersion(String.Format("{0}.{1}.{2}.*", dt.Year, dt.Month. dt.Day))]
I'm aware this isn't possible though.
Is there an alternative way of achieving this?
Versions are usually set by the build server however you can use a T4 template to generate your assembly info. I do this so I don't have to change dates manually. Add a file called AssemblyInfo.tt and add the following to it:
Add the code you need to generate your version number. For more information see: http://msdn.microsoft.com/en-us/library/bb126445.aspx