@@ -31,12 +31,38 @@ function Invoke-AppVeyorInstall {
31
31
Install-Module - Name platyPS - Force - Scope CurrentUser - RequiredVersion $platyPSVersion - Repository PSGallery
32
32
}
33
33
34
- # the build script sorts out the problems of WMF4 and earlier versions of dotnet CLI
34
+ # Do not use ' build.ps1 -bootstrap' option for bootstraping the .Net SDK as it does not work well in CI with the AppVeyor Ubuntu image
35
35
Write-Verbose - Verbose " Installing required .Net CORE SDK"
36
- Write-Verbose " & $buildScriptDir /build.ps1 -bootstrap"
37
- $buildScriptDir = (Resolve-Path " $PSScriptRoot /.." ).Path
38
- & " $buildScriptDir /build.ps1" - bootstrap
39
- $Global :LASTEXITCODE = $LASTEXITCODE = 0 # needed to avoid a premature abortion of the AppVeyor Ubuntu build
36
+ # the legacy WMF4 image only has the old preview SDKs of dotnet
37
+ $globalDotJson = Get-Content (Join-Path $PSScriptRoot ' ..\global.json' ) - Raw | ConvertFrom-Json
38
+ $requiredDotNetCoreSDKVersion = $globalDotJson.sdk.version
39
+ if ($PSVersionTable.PSVersion.Major -gt 4 ) {
40
+ $requiredDotNetCoreSDKVersionPresent = (dotnet -- list- sdks) -match $requiredDotNetCoreSDKVersion
41
+ }
42
+ else {
43
+ # WMF 4 image has old SDK that does not have --list-sdks parameter
44
+ $requiredDotNetCoreSDKVersionPresent = (dotnet -- version).StartsWith($requiredDotNetCoreSDKVersion )
45
+ }
46
+ if (-not $requiredDotNetCoreSDKVersionPresent ) {
47
+ Write-Verbose - Verbose " Installing required .Net CORE SDK $requiredDotNetCoreSDKVersion "
48
+ $originalSecurityProtocol = [Net.ServicePointManager ]::SecurityProtocol
49
+ try {
50
+ [Net.ServicePointManager ]::SecurityProtocol = [Net.ServicePointManager ]::SecurityProtocol -bor [Net.SecurityProtocolType ]::Tls12
51
+ if ($IsLinux -or $isMacOS ) {
52
+ Invoke-WebRequest ' https://dot.net/v1/dotnet-install.sh' - OutFile dotnet- install.sh
53
+ bash dotnet- install.sh -- version $requiredDotNetCoreSDKVersion
54
+ [System.Environment ]::SetEnvironmentVariable(' PATH' , " /home/appveyor/.dotnet$ ( [System.IO.Path ]::PathSeparator) $PATH " )
55
+ }
56
+ else {
57
+ Invoke-WebRequest ' https://dot.net/v1/dotnet-install.ps1' - OutFile dotnet- install.ps1
58
+ .\dotnet- install.ps1 - Version $requiredDotNetCoreSDKVersion
59
+ }
60
+ }
61
+ finally {
62
+ [Net.ServicePointManager ]::SecurityProtocol = $originalSecurityProtocol
63
+ Remove-Item .\dotnet- install.*
64
+ }
65
+ }
40
66
}
41
67
42
68
# Implements AppVeyor 'test_script' step
0 commit comments