Skip to content

Commit 0ed9925

Browse files
authored
[ci] Update dotnet and global tool installs (#1132)
The `performMultiLevelLookup` parameter has been removed from the dotnet install steps to ensure that we always attempt to install / use a dotnet in $(Agent.ToolsDirectory). The dotnet install path will also now be cleaned up when running on macOS. Global tools will now be uninstalled before installing the new version to avoid any potential downgrade errors. Installation will also now use the DotNetCoreCLI@2 task directly.
1 parent e73c7a0 commit 0ed9925

File tree

1 file changed

+24
-6
lines changed

1 file changed

+24
-6
lines changed

build/ci/setup-environment.yml

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,18 @@ parameters:
66
javaSdkRoot: $(Agent.ToolsDirectory)\jdk11
77

88
steps:
9-
# before the build starts, make sure the tooling is as expected
9+
# before the build starts, make sure the tooling is as expected. Clear the cache on shared agents
10+
- script: |
11+
dotnet build-server shutdown
12+
rm -rf $(Agent.ToolsDirectory)/dotnet
13+
displayName: Remove dotnet cache
14+
workingDirectory: $(Pipeline.Workspace)
15+
condition: eq(variables['Agent.OS'], 'Darwin')
16+
1017
- task: UseDotNet@2
1118
displayName: 'Use dotnet $(dotnetVersion)'
1219
inputs:
1320
version: $(dotnetVersion)
14-
performMultiLevelLookup: true
1521
includePreviewVersions: true
1622
condition: ne('$(dotnetVersion)', '')
1723

@@ -20,13 +26,25 @@ steps:
2026
displayName: 'Use dotnet $(dotnetNextVersion)'
2127
inputs:
2228
version: $(dotnetNextVersion)
23-
performMultiLevelLookup: true
2429
includePreviewVersions: true
25-
30+
31+
- script: dotnet --info
32+
displayName: Display dotnet info
33+
2634
- ${{ each tool in parameters.dotnetTools }}:
2735
- ${{ each pair in tool }}:
28-
- pwsh: dotnet tool update -g ${{ pair.key }} --version ${{ pair.value }}
29-
displayName: 'Install tool: ${{ pair.key }}'
36+
- powershell: dotnet tool uninstall ${{ pair.key }} -g
37+
displayName: 'Uninstall tool: ${{ pair.key }}'
38+
ignoreLASTEXITCODE: true
39+
- task: DotNetCoreCLI@2
40+
displayName: 'Install tool: ${{ pair.key }} ${{ pair.value }}'
41+
inputs:
42+
command: custom
43+
custom: tool
44+
arguments: >-
45+
update -g ${{ pair.key }} -v:diag
46+
--version ${{ pair.value }}
47+
--add-source "https://api.nuget.org/v3/index.json"
3048
3149
- ${{ if eq(parameters.runDotnetNextTest, true) }}:
3250
- pwsh: |

0 commit comments

Comments
 (0)