diff --git a/scripts/build.ps1 b/scripts/build.ps1 index ff880fbef6..725caab438 100644 --- a/scripts/build.ps1 +++ b/scripts/build.ps1 @@ -57,8 +57,11 @@ $env:TP_OUT_DIR = Join-Path $env:TP_ROOT_DIR "artifacts" $env:TP_PACKAGE_PROJ_DIR = Join-Path $env:TP_ROOT_DIR "src\package" # Set Version from scripts/build/TestPlatform.Settings.targets +if([string]::IsNullOrWhiteSpace($Version)) +{ $Version = ([xml](Get-Content $env:TP_ROOT_DIR\scripts\build\TestPlatform.Settings.targets)).Project.PropertyGroup.TPVersionPrefix $Version = ($Version).Trim() +} # # Dotnet configuration diff --git a/scripts/vsts-prebuild.ps1 b/scripts/vsts-prebuild.ps1 index a85df829f5..2114e74ea5 100644 --- a/scripts/vsts-prebuild.ps1 +++ b/scripts/vsts-prebuild.ps1 @@ -1,10 +1,20 @@ # Sets variables which are used across the build tasks. -$buildPrefix = $args[0] -if ($args[2].ToLower() -eq "false") { - $buildSuffix = $args[1] +$buildSuffix = $args[0] +$IsRtmBuild = $args[1] + +$TP_ROOT_DIR = (Get-Item (Split-Path $MyInvocation.MyCommand.Path)).Parent.FullName + +# Set Version from scripts/build/TestPlatform.Settings.targets +$TpVersion = [string](([xml](Get-Content $TP_ROOT_DIR\scripts\build\TestPlatform.Settings.targets)).Project.PropertyGroup.TPVersionPrefix) +$buildPrefix = $TpVersion.Trim() + +if ($IsRtmBuild.ToLower() -eq "false") +{ $packageVersion = $buildPrefix+"-"+$buildSuffix -} else { +} +else +{ $packageVersion = $buildPrefix $buildSuffix = [string]::Empty } @@ -16,6 +26,5 @@ Write-Host "##vso[task.setvariable variable=PackageVersion;]$packageVersion" # Set Newtonsoft.Json version to consume in CI build "Package: TestPlatform SDK" task. # "Nuget.exe pack" required JsonNetVersion property for creating nuget package. -$TP_ROOT_DIR = (Get-Item (Split-Path $MyInvocation.MyCommand.Path)).Parent.FullName $JsonNetVersion = ([xml](Get-Content $TP_ROOT_DIR\scripts\build\TestPlatform.Dependencies.props)).Project.PropertyGroup.JsonNetVersion Write-Host "##vso[task.setvariable variable=JsonNetVersion;]$JsonNetVersion" \ No newline at end of file