Skip to content

Commit fde004d

Browse files
author
Konrad Jamrozik
authored
Install .NET 6.0.x SDK. Remove DotNetCoreVersion param. Undo DOTNET_ROLL_FORWARD - take 2 (#5405)
1 parent 92c4c76 commit fde004d

2 files changed

Lines changed: 22 additions & 33 deletions

File tree

eng/pipelines/templates/stages/archetype-sdk-tool-dotnet.yml

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ parameters:
1515
- name: TestDirectory
1616
type: string
1717
default: ''
18-
- name: DotNetCoreVersion
19-
type: string
20-
default: ''
2118
- name: NoWarn
2219
type: boolean
2320
default: false
@@ -65,8 +62,6 @@ stages:
6562

6663
steps:
6764
- template: /eng/pipelines/templates/steps/install-dotnet.yml
68-
parameters:
69-
DotNetCoreVersion: ${{ parameters.DotNetCoreVersion }}
7065

7166
- script: 'dotnet pack /p:ArtifactsPackagesDir=$(packagesToPublishDir) $(Warn) -c Release'
7267
displayName: 'Build and Package'
@@ -115,8 +110,6 @@ stages:
115110

116111
steps:
117112
- template: /eng/pipelines/templates/steps/install-dotnet.yml
118-
parameters:
119-
DotNetCoreVersion: ${{ parameters.DotNetCoreVersion }}
120113

121114
- template: /eng/pipelines/templates/steps/produce-net-standalone-packs.yml
122115
parameters:
@@ -144,8 +137,6 @@ stages:
144137

145138
steps:
146139
- template: /eng/pipelines/templates/steps/install-dotnet.yml
147-
parameters:
148-
DotNetCoreVersion: ${{ parameters.DotNetCoreVersion }}
149140

150141
- script: 'dotnet test /p:ArtifactsPackagesDir=$(Build.ArtifactStagingDirectory) $(Warn) --logger trx'
151142
displayName: 'Test'
@@ -161,7 +152,7 @@ stages:
161152
condition: succeededOrFailed()
162153
inputs:
163154
testResultsFiles: '**/*.trx'
164-
testRunTitle: $(System.JobDisplayName) ${{ parameters.DotNetCoreVersion }}
155+
testRunTitle: $(System.JobDisplayName)
165156
testResultsFormat: 'VSTest'
166157
mergeTestResults: true
167158

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,27 @@
1-
parameters:
2-
# Use this parameter if you want to override the .NET SDK set by global.json
3-
- name: DotNetCoreVersion
4-
type: string
5-
default: ''
6-
71
steps:
8-
# We set DOTNET_ROLL_FORWARD so that .NET assemblies targeting older versions of .NET can run on newer ones.
9-
# See also:
10-
# https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet#options-for-running-an-application
11-
# https://learn.microsoft.com/en-us/dotnet/core/runtime-discovery/troubleshoot-app-launch?pivots=os-windows#required-framework-not-found
12-
# https://aka.ms/dotnet/app-launch-failed
13-
# https://learn.microsoft.com/en-us/azure/devops/pipelines/scripts/logging-commands?view=azure-devops&tabs=powershell
14-
# https://learn.microsoft.com/en-us/azure/devops/pipelines/process/set-variables-scripts?view=azure-devops&tabs=powershell
15-
- pwsh: |
16-
echo "##vso[task.setvariable variable=DOTNET_ROLL_FORWARD;]Major"
17-
displayName: "Set DOTNET_ROLL_FORWARD to Major"
18-
# https://learn.microsoft.com/azure/devops/pipelines/tasks/reference/use-dotnet-v2?view=azure-pipelines
2+
3+
# We aim to keep .NET SDK coming from global.json to bethe newest, to enable us to use the latest & greatest,
4+
# and allow us to gradually migrate our .NET sources to such version.
5+
# About global.json: https://learn.microsoft.com/en-us/dotnet/core/tools/global-json
6+
- task: UseDotNet@2 # About UseDotNet@2 task: https://learn.microsoft.com/azure/devops/pipelines/tasks/reference/use-dotnet-v2?view=azure-pipelines
7+
displayName: "Use .NET SDK from global.json"
8+
retryCountOnTaskFailure: 3
9+
inputs:
10+
useGlobalJson: true
11+
12+
# We install .NET 6.0.x SDK in addition to .NET coming from global.json because most of our tools target 6.0.x.
13+
# Once we migrate all tools to a newer .NET version, we should update this to install that version instead.
1914
- task: UseDotNet@2
20-
displayName: "Use .NET SDK ${{ coalesce( parameters.DotNetCoreVersion, 'from global.json') }}"
15+
displayName: "Use .NET SDK 6.0.x"
2116
retryCountOnTaskFailure: 3
2217
inputs:
23-
${{ if eq( parameters.DotNetCoreVersion, '') }}:
24-
useGlobalJson: true
25-
${{ else }}:
26-
version: ${{ parameters.DotNetCoreVersion }}
18+
# We must install sdk, not just runtime, as it is required by some of our tools, like test-proxy.
19+
# For additional context, see PR: https://github.com/Azure/azure-sdk-tools/pull/5405
20+
packageType: sdk
21+
version: 6.0.x
22+
# performMultiLevelLookup comes into play when given .NET executable target runtime is different
23+
# than the installed .NET SDK. Without this, such runtime would not be found.
24+
performMultiLevelLookup: true
2725

2826
# Future work: add NuGet packages caching. See:
29-
# https://github.com/Azure/azure-sdk-tools/issues/5086
27+
# https://github.com/Azure/azure-sdk-tools/issues/5086

0 commit comments

Comments
 (0)