Skip to content

Commit eb29fba

Browse files
authored
[release/10.0] Install MicroBuild in temporary directory (#16307) (#16342)
1 parent 204a301 commit eb29fba

File tree

1 file changed

+24
-5
lines changed

1 file changed

+24
-5
lines changed

eng/common/core-templates/steps/install-microbuild.yml

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@ parameters:
1111
# Unfortunately, _SignType can't be used to exclude the use of the service connection in non-real sign scenarios. The
1212
# variable is not available in template expression. _SignType has a very large proliferation across .NET, so replacing it is tough.
1313
microbuildUseESRP: true
14-
# Location of the MicroBuild output folder
15-
# NOTE: There's something that relies on this being in the "default" source directory for tasks such as Signing to work properly.
16-
microBuildOutputFolder: '$(Build.SourcesDirectory)'
14+
# Microbuild installation directory
15+
microBuildOutputFolder: $(Agent.TempDirectory)/MicroBuild
1716

1817
continueOnError: false
1918

@@ -26,8 +25,27 @@ steps:
2625
inputs:
2726
packageType: sdk
2827
version: 8.0.x
29-
installationPath: ${{ parameters.microBuildOutputFolder }}/.dotnet
30-
workingDirectory: ${{ parameters.microBuildOutputFolder }}
28+
installationPath: ${{ parameters.microBuildOutputFolder }}/.dotnet-microbuild
29+
condition: and(succeeded(), ne(variables['Agent.Os'], 'Windows_NT'))
30+
31+
- script: |
32+
set -euo pipefail
33+
34+
# UseDotNet@2 prepends the dotnet executable path to the PATH variable, so we can call dotnet directly
35+
version=$(dotnet --version)
36+
cat << 'EOF' > ${{ parameters.microBuildOutputFolder }}/global.json
37+
{
38+
"sdk": {
39+
"version": "$version",
40+
"paths": [
41+
"${{ parameters.microBuildOutputFolder }}/.dotnet-microbuild"
42+
],
43+
"errorMessage": "The .NET SDK version $version is required to install the MicroBuild signing plugin."
44+
}
45+
}
46+
EOF
47+
displayName: 'Add global.json to MicroBuild Installation path'
48+
workingDirectory: ${{ parameters.microBuildOutputFolder }}
3149
condition: and(succeeded(), ne(variables['Agent.Os'], 'Windows_NT'))
3250
3351
- script: |
@@ -77,6 +95,7 @@ steps:
7795
signType: $(_SignType)
7896
zipSources: false
7997
feedSource: https://dnceng.pkgs.visualstudio.com/_packaging/MicroBuildToolset/nuget/v3/index.json
98+
workingDirectory: ${{ parameters.microBuildOutputFolder }}
8099
${{ if eq(parameters.microbuildUseESRP, true) }}:
81100
ConnectedServiceName: 'MicroBuild Signing Task (DevDiv)'
82101
${{ if eq(variables['System.TeamProject'], 'DevDiv') }}:

0 commit comments

Comments
 (0)