2019-10-01 08:18:02 +00:00
|
|
|
# For debugging purposes
|
|
|
|
if (-not (Test-Path env:APPVEYOR_BUILD_FOLDER))
|
|
|
|
{
|
|
|
|
Write-Host "Warning: APPVEYOR_BUILD_FOLDER environment variable not set"
|
|
|
|
$env:APPVEYOR_BUILD_FOLDER = "P:\Tapeti"
|
|
|
|
}
|
|
|
|
|
|
|
|
if (-not (Test-Path env:GitVersion_AssemblySemVer))
|
|
|
|
{
|
|
|
|
Write-Host "Warning: GitVersion_AssemblySemVer environment variable not set"
|
|
|
|
$env:GitVersion_AssemblySemVer = "2.0.0"
|
|
|
|
}
|
|
|
|
|
2019-10-01 08:23:25 +00:00
|
|
|
Write-Host "Updating version to $($env:GitVersion_AssemblySemVer) for projects in $($env:APPVEYOR_BUILD_FOLDER)"
|
2019-10-01 08:18:02 +00:00
|
|
|
|
|
|
|
$projectFiles = Get-ChildItem $env:APPVEYOR_BUILD_FOLDER -Recurse *.csproj | Select -ExpandProperty FullName
|
|
|
|
foreach ($projectFile in $projectFiles)
|
|
|
|
{
|
|
|
|
$contents = Get-Content -Path $projectFile
|
|
|
|
if ($contents -match "<Version>(.+?)</Version>")
|
|
|
|
{
|
|
|
|
$contents = $contents -replace "<Version>(.+?)</Version>", "<Version>$($env:GitVersion_AssemblySemVer)</Version>"
|
|
|
|
Set-Content -Path $projectFile -Value $contents
|
|
|
|
Write-Host "Updated $($projectFile)"
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Write-Host "No version information in $($projectFile)"
|
|
|
|
}
|
|
|
|
}
|