2019-10-01 10:18:02 +02: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"
|
|
|
|
}
|
|
|
|
|
2019-10-01 10:27:48 +02:00
|
|
|
if (-not (Test-Path env:GitVersion_MajorMinorPatch))
|
2019-10-01 10:18:02 +02:00
|
|
|
{
|
2019-10-01 10:27:48 +02:00
|
|
|
Write-Host "Warning: GitVersion_MajorMinorPatch environment variable not set"
|
|
|
|
$env:GitVersion_MajorMinorPatch = "0.0.1"
|
2019-10-01 10:18:02 +02:00
|
|
|
}
|
|
|
|
|
2019-10-01 10:27:48 +02:00
|
|
|
if (-not (Test-Path env:GitVersion_CommitsSinceVersionSource))
|
|
|
|
{
|
|
|
|
Write-Host "Warning: GitVersion_CommitsSinceVersionSource environment variable not set"
|
|
|
|
$env:GitVersion_CommitsSinceVersionSource = "42"
|
|
|
|
}
|
|
|
|
|
|
|
|
$version = "$($env:GitVersion_MajorMinorPatch).$($env:GitVersion_CommitsSinceVersionSource)"
|
|
|
|
|
|
|
|
Write-Host "Updating version to $($version) for projects in $($env:APPVEYOR_BUILD_FOLDER)"
|
2019-10-01 10:18:02 +02: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>")
|
|
|
|
{
|
2019-10-01 10:27:48 +02:00
|
|
|
$contents = $contents -replace "<Version>(.+?)</Version>", "<Version>$($version)</Version>"
|
2019-10-01 10:18:02 +02:00
|
|
|
Set-Content -Path $projectFile -Value $contents
|
|
|
|
Write-Host "Updated $($projectFile)"
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Write-Host "No version information in $($projectFile)"
|
|
|
|
}
|
|
|
|
}
|