This is a msbuild file which will update AssemblyInfo.cs
in your TFS connected VS project automatically on Release
build.
It queries the history from TFS, get latest changeset id and modified date, then modify the existing AssemblyVersion
and AssemblyFileVersion
accordingly.
The version is formatted as $(MajorVersion).$(MinorVersion).$(ChangesetId).$(Mdd)
where
- $(MajorVersion): Default is 1
- $(MinorVersion): Default is 0
- $(ChangesetId): Latest changeset id of project history queried from TFS
- $(Mdd): Latest changeset modified date in
Mdd
format
To prevent assembly referencing issue (strong name, version conflict, etc.), only
AssemblyFileVersion
will change all parts of revision number,AssemblyVersion
changes only if theMajorVersion
orMinorVersion
have been changed.
- Run
Install-Package Ltc.MSBuild.UpdateVersion.targets
command in the Package Manager Console. - Done, that's all you have to do.
- Add
Build\UpdateVersion.targets
andBuild\VersionInfo.targets
files to your project. - Add
<Import />
to your project file (.csproj
).