Created
February 11, 2016 16:18
-
-
Save vsliouniaev/6b159484590f009102dc to your computer and use it in GitHub Desktop.
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
param( | |
[Parameter(mandatory=$true)] | |
[ValidatePattern('[^"]+')] | |
[string]$version | |
) | |
# Jump up one directory up from where the script file is located | |
Push-Location ((Split-Path $MyInvocation.MyCommand.Path) + '\..') | |
function UpdateDevInfo([string]$fileLocation) | |
{ | |
$githash = [string](git rev-parse HEAD) | |
$content = (get-content $fileLocation) | |
$content = ForEach-Object { | |
$content -replace "AssemblyFileVersion`\(`"[^`"]+'`\)","AssemblyFileVersion(`"$githash`")" | |
} | |
$content = ForEach-Object { | |
$content -replace "AssemblyInformationalVersion`\(`"[^']+`"`\)","AssemblyInformationalVersion(`"$version`")" | |
} | |
Set-Content $fileLocation $content | |
} | |
UpdateDevInfo("path\to\assemblyinfofile1.cs") | |
UpdateDevInfo("path\to\assemblyinfofile2.cs") | |
Pop-Location |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment