Skip to content

Commit 21aeaad

Browse files
Revert build script fixes
Revert some changes to the build scripts but try and retain workaround for Azure Pipelines.
1 parent a94ace8 commit 21aeaad

File tree

1 file changed

+30
-5
lines changed

1 file changed

+30
-5
lines changed

Build.ps1

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ param(
55
[Parameter(Mandatory = $false)][switch] $SkipTests
66
)
77

8+
# These make CI builds faster
9+
$env:DOTNET_MULTILEVEL_LOOKUP = "0"
10+
$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE = "true"
11+
$env:NUGET_XMLDOC_MODE = "skip"
12+
813
$ErrorActionPreference = "Stop"
914
$ProgressPreference = "SilentlyContinue"
1015

@@ -52,13 +57,33 @@ else {
5257

5358
if ($installDotNetSdk -eq $true) {
5459

55-
$installScript = Join-Path (Join-Path "$(Convert-Path "$PSScriptRoot")" ".dotnetcli") "install.ps1"
56-
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor "Tls12"
57-
Invoke-WebRequest "https://dot.net/v1/dotnet-install.ps1" -OutFile $installScript -UseBasicParsing
58-
& $installScript -Version "$dotnetVersion"
60+
if (($null -ne $env:TF_BUILD)) {
61+
$env:DOTNET_INSTALL_DIR = Join-Path $env:ProgramFiles "dotnet"
62+
} else {
63+
$env:DOTNET_INSTALL_DIR = Join-Path "$(Convert-Path "$PSScriptRoot")" ".dotnetcli"
64+
}
65+
66+
$sdkPath = Join-Path $env:DOTNET_INSTALL_DIR "sdk\$dotnetVersion"
67+
68+
if (($null -ne $env:TF_BUILD) -or (!(Test-Path $sdkPath))) {
69+
if (!(Test-Path $env:DOTNET_INSTALL_DIR)) {
70+
mkdir $env:DOTNET_INSTALL_DIR | Out-Null
71+
}
72+
$installScript = Join-Path $env:DOTNET_INSTALL_DIR "install.ps1"
73+
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor "Tls12"
74+
Invoke-WebRequest "https://dot.net/v1/dotnet-install.ps1" -OutFile $installScript -UseBasicParsing
75+
& $installScript -Version "$dotnetVersion" -InstallDir "$env:DOTNET_INSTALL_DIR" -NoPath
76+
}
77+
}
78+
else {
79+
$env:DOTNET_INSTALL_DIR = Split-Path -Path (Get-Command dotnet.exe).Path
5980
}
6081

61-
$dotnet = "dotnet"
82+
$dotnet = Join-Path "$env:DOTNET_INSTALL_DIR" "dotnet.exe"
83+
84+
if (($installDotNetSdk -eq $true) -And ($null -eq $env:TF_BUILD)) {
85+
$env:PATH = "$env:DOTNET_INSTALL_DIR;$env:PATH"
86+
}
6287

6388
function DotNetPack {
6489
param([string]$Project)

0 commit comments

Comments
 (0)