Created
July 5, 2015 20:33
-
-
Save FeodorFitsner/e038821e3e46e3df0e8f to your computer and use it in GitHub Desktop.
Taking version from AssemblyInfo.cs and using it with AppVeyor
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
rem This is how we get version in environment variable | |
for /f %%i in ('PowerShell -File get-version.ps1') do set my_version=%%i |
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
$directoryPath = Split-Path ((Get-Variable MyInvocation).Value).MyCommand.Path | |
$assemblyFile = "$directoryPath\VersionInfo.cs" | |
$RegularExpression = [regex] 'AssemblyVersion\(\"(.*)\"\)' | |
# Get the Content of the file and store it in the variable | |
$fileContent = Get-Content $assemblyFile | |
#$fileContent | |
foreach($content in $fileContent) | |
{ | |
$match = [System.Text.RegularExpressions.Regex]::Match($content, $RegularExpression) | |
if($match.Success) { | |
$match.groups[1].value | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Positively incredible that CI/CD has been "evolving" for nearly a decade and the simple matter of properly versioning artifacts remains frustratingly elusive. 🤦♂️