Created
August 11, 2017 18:25
-
-
Save georgepaoli/4273f3d1240458fdd13620d560705446 to your computer and use it in GitHub Desktop.
Custom build version number in dotnet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |
<Target Name="BeforeBuild"> | |
<!-- https://stackoverflow.com/a/6472195/2076784 --> | |
<PropertyGroup> | |
<Year>$([System.DateTime]::Now.ToString("yyyy"))</Year> | |
<Month>$([System.DateTime]::Now.ToString("MM"))</Month> | |
<Date>$([System.DateTime]::Now.ToString("dd"))</Date> | |
<Time>$([System.DateTime]::Now.ToString("HHmm"))</Time> | |
<AssemblyFileVersionAttribute>[assembly:System.Reflection.AssemblyFileVersion("$(Year).$(Month).$(Date).$(Time)")]</AssemblyFileVersionAttribute> | |
</PropertyGroup> | |
<WriteLinesToFile File="Properties\VersionInfo.cs" Lines="$(AssemblyFileVersionAttribute)" Overwrite="true"> | |
</WriteLinesToFile> | |
</Target> | |
</Project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment