Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Taking version from AssemblyInfo.cs and using it with AppVeyor
rem This is how we get version in environment variable
for /f %%i in ('PowerShell -File get-version.ps1') do set my_version=%%i
$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
}
}
@rbonestell

This comment has been minimized.

Copy link

commented Nov 9, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.