Skip to content

Commit 204a301

Browse files
authored
Revert "[release/10.0] Add a second .NET path for MicroBuild" (#16308)
1 parent 3992c10 commit 204a301

File tree

15 files changed

+118
-318
lines changed

15 files changed

+118
-318
lines changed

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

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,23 @@ 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)'
1417

1518
continueOnError: false
1619

1720
steps:
1821
- ${{ if eq(parameters.enableMicrobuild, 'true') }}:
1922
- ${{ if eq(parameters.enableMicrobuildForMacAndLinux, 'true') }}:
20-
# Installing .NET 8 is required to use the MicroBuild signing plugin on non-Windows platforms
23+
# Needed to download the MicroBuild plugin nupkgs on Mac and Linux when nuget.exe is unavailable
2124
- task: UseDotNet@2
2225
displayName: Install .NET 8.0 SDK for MicroBuild Plugin
2326
inputs:
2427
packageType: sdk
2528
version: 8.0.x
26-
# Installing the SDK in a '.dotnet-microbuild' directory is required for signing.
27-
# See target FindDotNetPathForMicroBuild in arcade/src/Microsoft.DotNet.Arcade.Sdk/tools/Sign.proj
28-
# Do not remove '.dotnet-microbuild' from the path without changing the corresponding logic.
29-
installationPath: $(Agent.TempDirectory)/.dotnet-microbuild
29+
installationPath: ${{ parameters.microBuildOutputFolder }}/.dotnet
30+
workingDirectory: ${{ parameters.microBuildOutputFolder }}
3031
condition: and(succeeded(), ne(variables['Agent.Os'], 'Windows_NT'))
3132

3233
- script: |
@@ -64,7 +65,7 @@ steps:
6465
ConnectedPMEServiceName: 248d384a-b39b-46e3-8ad5-c2c210d5e7ca
6566
env:
6667
TeamName: $(_TeamName)
67-
MicroBuildOutputFolderOverride: $(Agent.TempDirectory)/MicroBuild
68+
MicroBuildOutputFolderOverride: ${{ parameters.microBuildOutputFolder }}
6869
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
6970
continueOnError: ${{ parameters.continueOnError }}
7071
condition: and(succeeded(), eq(variables['Agent.Os'], 'Windows_NT'), in(variables['_SignType'], 'real', 'test'))
@@ -84,7 +85,7 @@ steps:
8485
ConnectedPMEServiceName: c24de2a5-cc7a-493d-95e4-8e5ff5cad2bc
8586
env:
8687
TeamName: $(_TeamName)
87-
MicroBuildOutputFolderOverride: $(Agent.TempDirectory)/MicroBuild
88+
MicroBuildOutputFolderOverride: ${{ parameters.microBuildOutputFolder }}
8889
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
8990
continueOnError: ${{ parameters.continueOnError }}
9091
condition: and(succeeded(), ne(variables['Agent.Os'], 'Windows_NT'), eq(variables['_SignType'], 'real'))

src/Microsoft.DotNet.Arcade.Sdk/tools/Sign.proj

Lines changed: 10 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. -->
2-
<Project DefaultTargets="Sign" InitialTargets="InitializeSignProperties;FindDotNetPathForMicroBuild">
2+
<Project DefaultTargets="Sign">
33

44
<!--
55
Documentation for publishing is available here:
@@ -43,7 +43,7 @@
4343
<FileSignInfo Update="@(FileSignInfo->WithMetadataValue('CertificateName','Microsoft400'))" CertificateName="$(DotNetCertificateName)" />
4444
</ItemGroup>
4545

46-
<Target Name="InitializeSignProperties">
46+
<Target Name="Sign">
4747
<Error Text="The value of DotNetSignType is invalid: '$(DotNetSignType)'"
4848
Condition="'$(DotNetSignType)' != 'real' and '$(DotNetSignType)' != 'test' and '$(DotNetSignType)' != ''" />
4949

@@ -55,54 +55,23 @@
5555
<_TestSign>false</_TestSign>
5656
<_TestSign Condition="'$(DotNetSignType)' == 'test'">true</_TestSign>
5757

58-
<_MicroBuildRequired>false</_MicroBuildRequired>
59-
<_MicroBuildRequired Condition="'$(_DryRun)' != 'true'">true</_MicroBuildRequired>
58+
<_DotNetCoreRequired>false</_DotNetCoreRequired>
59+
<_DotNetCoreRequired Condition="'$(_DryRun)' != 'true'">true</_DotNetCoreRequired>
6060

6161
<!-- SN is only available on Windows -->
6262
<SNBinaryPath Condition="$([MSBuild]::IsOSPlatform('Windows'))">$(NuGetPackageRoot)sn\$(SNVersion)\sn.exe</SNBinaryPath>
6363

6464
<!-- .pkgs and .app bundle tooling is only available on MacOS -->
6565
<PkgToolPath Condition="$([MSBuild]::IsOSPlatform('OSX'))">$(NuGetPackageRoot)microsoft.dotnet.macospkg.cli\$(MicrosoftDotNetMacOsPkgVersion)\tools\$(NetToolCurrent)\any\Microsoft.Dotnet.MacOsPkg.Cli.dll</PkgToolPath>
6666
</PropertyGroup>
67-
</Target>
68-
69-
<Target Name="FindDotNetPathForMicroBuild" Condition="'$(_MicroBuildRequired)' == 'true'">
70-
<!--
71-
On non-Windows platforms, MicroBuild needs the .NET 8 SDK for signing.
72-
Non-windows signed (real or test) builds will install this SDK into a */.dotnet-microbuild/* directory
73-
and add it to the PATH.
74-
-->
75-
<PropertyGroup>
76-
<UseDotNetToolPathForMicroBuild>false</UseDotNetToolPathForMicroBuild>
77-
<UseDotNetToolPathForMicroBuild Condition="$([MSBuild]::IsOSPlatform('Windows'))">true</UseDotNetToolPathForMicroBuild>
78-
79-
<!-- Default for Windows. Default fallback for non-windows. -->
80-
<_DotNetPathMicroBuild>$(DotNetTool)</_DotNetPathMicroBuild>
81-
</PropertyGroup>
82-
83-
<ItemGroup Condition="'$(UseDotNetToolPathForMicroBuild)' == 'false'">
84-
<_ItemInPath Include="$([System.Text.RegularExpressions.Regex]::Split('$(PATH)', '$([System.Convert]::ToString($([System.IO.Path]::PathSeparator)))'))" />
85-
86-
<_DotNetPathMicroBuildCandidate
87-
Include="@(_ItemInPath->'%(Identity)/dotnet')"
88-
Condition="$([System.Text.RegularExpressions.Regex]::IsMatch('%(Identity)', '.dotnet-microbuild')) and Exists('%(Identity)/dotnet')" />
89-
</ItemGroup>
90-
91-
<PropertyGroup Condition="'@(_DotNetPathMicroBuildCandidate)' != ''">
92-
<!-- This gets overwritten for each item, so the last one wins -->
93-
<_DotNetPathMicroBuild>%(_DotNetPathMicroBuildCandidate.Identity)</_DotNetPathMicroBuild>
94-
</PropertyGroup>
95-
96-
<Message
97-
Importance="High"
98-
Condition="'$(UseDotNetToolPathForMicroBuild)' == 'false' and '$(_DotNetPathMicroBuild)' == '$(DotNetTool)'"
99-
Text="Did not find a dotnet executable in a MicroBuild directory on PATH. Using $(DotNetTool) instead, which may cause signing errors." />
100-
</Target>
10167

102-
<Target Name="Sign">
10368
<Error Condition="'$(AllowEmptySignList)' != 'true' AND '@(ItemsToSign)' == ''"
10469
Text="List of files to sign is empty. Make sure that ItemsToSign is configured correctly." />
10570

71+
<PropertyGroup Condition="$(_DotNetCoreRequired)">
72+
<_DotNetCorePath>$(DotNetTool)</_DotNetCorePath>
73+
</PropertyGroup>
74+
10675
<!-- Keep TarToolPath TFM in sync with TarTool project TFM. -->
10776
<Microsoft.DotNet.SignTool.SignToolTask
10877
DryRun="$(_DryRun)"
@@ -117,8 +86,7 @@
11786
FileExtensionSignInfo="@(FileExtensionSignInfo)"
11887
TempDir="$(ArtifactsTmpDir)"
11988
LogDir="$(ArtifactsLogDir)"
120-
DotNetPathMicroBuild="$(_DotNetPathMicroBuild)"
121-
DotNetPathTooling="$(DotNetTool)"
89+
DotNetPath="$(_DotNetCorePath)"
12290
SNBinaryPath="$(SNBinaryPath)"
12391
MicroBuildCorePath="$(NuGetPackageRoot)microsoft.visualstudioeng.microbuild.core\$(MicrosoftVisualStudioEngMicroBuildCoreVersion)"
12492
Wix3ToolsPath="$(WixInstallPath)"
@@ -130,4 +98,5 @@
13098
DotNetTimeout="$(SignToolDotNetTimeout)"
13199
MSBuildVerbosity="$(SignToolMSBuildVerbosity)" />
132100
</Target>
101+
133102
</Project>

src/Microsoft.DotNet.SignTool.Tests/Config.cs

Lines changed: 0 additions & 20 deletions
This file was deleted.

src/Microsoft.DotNet.SignTool.Tests/FakeSignTool.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,6 @@ private static void SignPEFile(string path)
6666

6767
public override SigningStatus VerifySignedVSIX(string filePath) => SigningStatus.Signed;
6868

69-
public override SigningStatus VerifySignedPkgOrAppBundle(
70-
TaskLoggingHelper log,
71-
string filePath,
72-
string dotNetPathTooling,
73-
string pkgToolPath) => SigningStatus.Signed;
69+
public override SigningStatus VerifySignedPkgOrAppBundle(TaskLoggingHelper log, string filePath, string pkgToolPath) => SigningStatus.Signed;
7470
}
7571
}

src/Microsoft.DotNet.SignTool.Tests/Microsoft.DotNet.SignTool.Tests.csproj

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,4 @@
8080
<Content Include="@(_PkgToolFiles)" CopyToOutputDirectory="PreserveNewest" Link="tools\pkg\%(RecursiveDir)%(Filename)%(Extension)"/>
8181
</ItemGroup>
8282
</Target>
83-
84-
<ItemGroup>
85-
<RuntimeHostConfigurationOption Include="$(MSBuildProjectName).DotNetPathTooling">
86-
<Value>$(DotNetTool)</Value>
87-
</RuntimeHostConfigurationOption>
88-
</ItemGroup>
8983
</Project>

0 commit comments

Comments
 (0)