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 hidden or 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 hidden or 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 | |
} | |
} |
Positively incredible that CI/CD has been "evolving" for nearly a decade and the simple matter of properly versioning artifacts remains frustratingly elusive. 🤦♂️
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Can you please elaborate on how to run the cmd and ps1 at the same time? It appears in my build settings that I only get to choose one script type and I'm already dependent upon
nuget restore
in cmd in my before build script.