Skip to content

Commit 261d795

Browse files
committed
.NET 10 build support in Azure DevOps
1 parent 3eeac22 commit 261d795

2 files changed

Lines changed: 95 additions & 1 deletion

File tree

.build/azure-templates/run-tests-on-os.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,31 @@ steps:
105105
& $installScriptPath -Version $sdkVersion -Architecture $architecture -InstallDir $installPath
106106
Write-Host "##vso[task.setvariable variable=DOTNET_ROOT_X86;]$installPath"
107107
displayName: 'Use .NET SDK ${{ parameters.dotNetSdkVersion }} (x86)'
108+
condition: and(succeeded(), contains('${{ parameters.framework }}', 'net10.'), eq('${{ parameters.vsTestPlatform }}', 'x86'))
109+
110+
- task: UseDotNet@2
111+
displayName: 'Use .NET SDK 9.0.308'
112+
inputs:
113+
packageType: 'sdk'
114+
version: '9.0.308'
115+
performMultiLevelLookup: '${{ variables.PerformMultiLevelLookup }}'
116+
condition: and(succeeded(), contains('${{ parameters.framework }}', 'net8.'))
117+
118+
# Hack: .NET 8+ no longer installs the x86 bits and they must be installed separately. However, it is not
119+
# trivial to get it into the path and to get it to pass the minimum SDK version check in runbuild.ps1.
120+
# So, we install it afterward and set the environment variable so the above SDK can delegate to it.
121+
# This code only works on Windows.
122+
- pwsh: |
123+
$sdkVersion = '9.0.308'
124+
$architecture = '${{ parameters.vsTestPlatform }}'
125+
$installScriptPath = "${env:AGENT_TEMPDIRECTORY}/dotnet-install.ps1"
126+
$installScriptUrl = "https://raw.githubusercontent.com/dotnet/install-scripts/main/src/dotnet-install.ps1"
127+
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
128+
Invoke-WebRequest $installScriptUrl -OutFile $installScriptPath -TimeoutSec 60
129+
$installPath = "${env:ProgramFiles(x86)}/dotnet"
130+
& $installScriptPath -Version $sdkVersion -Architecture $architecture -InstallDir $installPath
131+
Write-Host "##vso[task.setvariable variable=DOTNET_ROOT_X86;]$installPath"
132+
displayName: 'Use .NET SDK 9.0.308 (x86)'
108133
condition: and(succeeded(), contains('${{ parameters.framework }}', 'net9.'), eq('${{ parameters.vsTestPlatform }}', 'x86'))
109134

110135
- task: UseDotNet@2

azure-pipelines.yml

Lines changed: 70 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ variables:
5757
- name: BuildCounter
5858
value: $[counter(variables['VersionSuffix'],coalesce(variables['BuildCounterSeed'], 1250))]
5959
- name: DotNetSDKVersion
60-
value: '9.0.300'
60+
value: '10.0.100'
6161
- name: DocumentationArtifactName
6262
value: 'docs'
6363
- name: DocumentationArtifactZipFileName
@@ -233,6 +233,15 @@ stages:
233233
displayName: 'Delete temp publish location: $(NuGetArtifactDirectory)'
234234
condition: and(succeeded(), ne(variables['RunPack'], 'false'))
235235
236+
- template: '.build/azure-templates/publish-test-binaries.yml'
237+
parameters:
238+
publishDirectory: $(PublishDirectory)
239+
framework: 'net10.0'
240+
binaryArtifactName: '$(BinaryArtifactName)'
241+
testSettingsFilePath: '$(Build.ArtifactStagingDirectory)/$(TestSettingsFileName)'
242+
configuration: '$(BuildConfiguration)'
243+
platform: '$(BuildPlatform)'
244+
236245
- template: '.build/azure-templates/publish-test-binaries.yml'
237246
parameters:
238247
publishDirectory: $(PublishDirectory)
@@ -330,6 +339,66 @@ stages:
330339
displayName: 'Test Stage:'
331340
jobs:
332341

342+
- job: Test_net10_0_x64
343+
condition: and(succeeded(), ne(variables['RunTests'], 'false'))
344+
strategy:
345+
matrix:
346+
Windows:
347+
osName: 'Windows'
348+
imageName: 'windows-latest'
349+
maximumParallelJobs: 8
350+
maximumAllowedFailures: 0 # Maximum allowed failures for a successful build
351+
Linux:
352+
osName: 'Linux'
353+
imageName: 'ubuntu-latest'
354+
maximumParallelJobs: 7
355+
maximumAllowedFailures: 0 # Maximum allowed failures for a successful build
356+
macOS:
357+
osName: 'macOS'
358+
imageName: 'macOS-latest'
359+
maximumParallelJobs: 7
360+
maximumAllowedFailures: 0 # Maximum allowed failures for a successful build
361+
displayName: 'Test net10.0,x64 on'
362+
pool:
363+
vmImage: $(imageName)
364+
steps:
365+
- template: '.build/azure-templates/run-tests-on-os.yml'
366+
parameters:
367+
osName: $(osName)
368+
framework: 'net10.0'
369+
vsTestPlatform: 'x64'
370+
testBinariesArtifactName: '$(TestBinariesArtifactName)'
371+
nugetArtifactName: '$(NuGetArtifactName)'
372+
testResultsArtifactName: '$(TestResultsArtifactName)'
373+
maximumParallelJobs: $(maximumParallelJobs)
374+
maximumAllowedFailures: $(maximumAllowedFailures)
375+
dotNetSdkVersion: '$(DotNetSDKVersion)'
376+
377+
- job: Test_net10_0_x86 # Only run Nightly or if explicitly enabled with RunX86Tests
378+
condition: and(succeeded(), ne(variables['RunTests'], 'false'), or(eq(variables['IsNightly'], 'true'), eq(variables['RunX86Tests'], 'true')))
379+
strategy:
380+
matrix:
381+
Windows:
382+
osName: 'Windows'
383+
imageName: 'windows-latest'
384+
maximumParallelJobs: 8
385+
maximumAllowedFailures: 0 # Maximum allowed failures for a successful build
386+
displayName: 'Test net10.0,x86 on'
387+
pool:
388+
vmImage: $(imageName)
389+
steps:
390+
- template: '.build/azure-templates/run-tests-on-os.yml'
391+
parameters:
392+
osName: $(osName)
393+
framework: 'net10.0'
394+
vsTestPlatform: 'x86'
395+
testBinariesArtifactName: '$(TestBinariesArtifactName)'
396+
nugetArtifactName: '$(NuGetArtifactName)'
397+
testResultsArtifactName: '$(TestResultsArtifactName)'
398+
maximumParallelJobs: $(maximumParallelJobs)
399+
maximumAllowedFailures: $(maximumAllowedFailures)
400+
dotNetSdkVersion: '$(DotNetSDKVersion)'
401+
333402
- job: Test_net9_0_x64
334403
condition: and(succeeded(), ne(variables['RunTests'], 'false'))
335404
strategy:

0 commit comments

Comments
 (0)