move cmd to ps

This commit is contained in:
Paddy Xu
2017-07-25 23:27:05 +03:00
parent 2138c0e123
commit 3fb18391df
3 changed files with 15 additions and 11 deletions

View File

@@ -263,6 +263,7 @@
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup> <PropertyGroup>
<PreBuildEvent>"$(SolutionDir)Scripts\update-version.cmd" "$(SolutionDir)" "$(SolutionDir)GitVersion.cs"</PreBuildEvent> <PreBuildEvent>powershell -file "$(SolutionDir)Scripts\update-version.ps1"
</PreBuildEvent>
</PropertyGroup> </PropertyGroup>
</Project> </Project>

View File

@@ -1,10 +0,0 @@
rem @echo off
cd %1
for /F "delims=" %%i in ('git describe --always --tags "--abbrev=0"') do set git_tag=%%i
for /F "delims=" %%i in ('git describe --always --tags') do set git_revision=%%i
echo // This file is generated by update-version.cmd > %2
echo. >> %2
echo using System.Reflection;>> %2
echo. >> %2
echo [assembly: AssemblyVersion("%git_tag%")]>> %2
echo [assembly: AssemblyInformationalVersion("%git_revision%")]>> %2

View File

@@ -0,0 +1,13 @@
$tag = git describe --always --tags "--abbrev=0"
$revision = git describe --always --tags
$text = @"
// This file is generated by update-version.ps1
using System.Reflection;
[assembly: AssemblyVersion("$tag")]
[assembly: AssemblyInformationalVersion("$revision")]
"@
$text | Out-File $PSScriptRoot\..\GitVersion.cs -Encoding utf8