Skip to content

Commit

Permalink
Add .NET 8 SDK conditionally for ADO build
Browse files Browse the repository at this point in the history
  • Loading branch information
paulirwin committed Nov 28, 2024
1 parent 7750779 commit 9af7518
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .build/azure-templates/run-tests-on-os.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,32 @@ steps:
displayName: 'Use .NET SDK ${{ parameters.dotNetSdkVersion }} (x86)'
condition: and(succeeded(), or(contains('${{ parameters.framework }}', 'net8.'), contains('${{ parameters.framework }}', 'net9.')), eq('${{ parameters.vsTestPlatform }}', 'x86'))

- task: UseDotNet@2
displayName: 'Use .NET SDK 8.0.404'
inputs:
packageType: 'sdk'
version: '8.0.404'
performMultiLevelLookup: '${{ variables.PerformMultiLevelLookup }}'
condition: and(succeeded(), contains('${{ parameters.framework }}', 'net8.'))

# Hack: .NET 8+ no longer installs the x86 bits and they must be installed separately. However, it is not
# trivial to get it into the path and to get it to pass the minimum SDK version check in runbuild.ps1.
# So, we install it afterward and set the environment variable so the above SDK can delegate to it.
# This code only works on Windows.
- pwsh: |
$sdkVersion = '8.0.404'
$architecture = '${{ parameters.vsTestPlatform }}'
$installScriptPath = "${env:AGENT_TEMPDIRECTORY}/dotnet-install.ps1"
$installScriptUrl = "https://raw.githubusercontent.com/dotnet/install-scripts/main/src/dotnet-install.ps1"
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Invoke-WebRequest $installScriptUrl -OutFile $installScriptPath -TimeoutSec 60
$installPath = "${env:ProgramFiles(x86)}/dotnet"
& $installScriptPath -Version $sdkVersion -Architecture $architecture -InstallDir $installPath
Write-Host "##vso[task.setvariable variable=DOTNET_ROOT_X86;]$installPath"
displayName: 'Use .NET SDK 8.0.404 (x86)'
condition: and(succeeded(), contains('${{ parameters.framework }}', 'net8.'), eq('${{ parameters.vsTestPlatform }}', 'x86'))


- task: UseDotNet@2
displayName: 'Use .NET SDK 6.0.421'
inputs:
Expand Down

0 comments on commit 9af7518

Please sign in to comment.