Replaces AssemblyInfo.cs versions with Major.Minor.YYDOY.HHmm
Batchfile
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.build
tools
.gitattributes
.gitignore
LICENSE
MSBuildTask.DatedVersion.1.0.0.1.nuspec
readme.md

readme.md

MsBuild Task Dated Version

Replaces AssemblyInfo.cs versions with Major.Minor.YYDOY.HHmm
Example, 1.0.16001.1030 for Jan 1, 2016 10:30 AM

The last segment (timestamp) can be manually edited with msbuild parameter /P:BuildNumber=[number]
Example, 1.0.16001.99 for Jan 1, 2016 /P:BuildNumber=99

Prerequisites

This requires the nuget package MSBuildTasks

Install-Package MSBuildTasks

Usage

To use this library, add .build\DateStampVersion.tasks to your solution folder.

Included Sample

You can use the inluded Build.proj to execute your solution file and update all versions, or you can manually add the build task to each project file.

Optional Manual Steps

Modify each PROJECT (*.csproj, *.vbproj) file to include the add the following to the top (after the <Project ...> tag)

<Import Project="$(MSBuildProjectDirectory)\DateStampVersion.tasks" />
<PropertyGroup>
  <SolutionRoot>$(MSBuildProjectDirectory)</SolutionRoot>
<PropertyGroup>
<ItemGroup>
  <RegexTransformItems Include="**\AssemblyInfo.cs" />
</ItemGroup>

Modify existing lines:

<Target Name="Go" DependsOnTargets="Build">
  to
<Target Name="Go" DependsOnTargets="UpdateAssemblyVersion; Build">

Add the following to the bottom of the file (before the </Project>)

  <Target Name="UpdateAssemblyVersion" >
      <RegexTransform Items="@(RegexTransformItems)" Vers="$(BuildNumber)" />
  </Target>

Execute the build normally, or add the BuildNumber parameter to your MSBuild command.