|
1 | 1 | <!-- 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"> |
3 | 3 |
|
4 | 4 | <!-- |
5 | 5 | Documentation for publishing is available here: |
|
43 | 43 | <FileSignInfo Update="@(FileSignInfo->WithMetadataValue('CertificateName','Microsoft400'))" CertificateName="$(DotNetCertificateName)" /> |
44 | 44 | </ItemGroup> |
45 | 45 |
|
46 | | - <Target Name="InitializeSignProperties"> |
| 46 | + <Target Name="Sign"> |
47 | 47 | <Error Text="The value of DotNetSignType is invalid: '$(DotNetSignType)'" |
48 | 48 | Condition="'$(DotNetSignType)' != 'real' and '$(DotNetSignType)' != 'test' and '$(DotNetSignType)' != ''" /> |
49 | 49 |
|
|
55 | 55 | <_TestSign>false</_TestSign> |
56 | 56 | <_TestSign Condition="'$(DotNetSignType)' == 'test'">true</_TestSign> |
57 | 57 |
|
58 | | - <_MicroBuildRequired>false</_MicroBuildRequired> |
59 | | - <_MicroBuildRequired Condition="'$(_DryRun)' != 'true'">true</_MicroBuildRequired> |
| 58 | + <_DotNetCoreRequired>false</_DotNetCoreRequired> |
| 59 | + <_DotNetCoreRequired Condition="'$(_DryRun)' != 'true'">true</_DotNetCoreRequired> |
60 | 60 |
|
61 | 61 | <!-- SN is only available on Windows --> |
62 | 62 | <SNBinaryPath Condition="$([MSBuild]::IsOSPlatform('Windows'))">$(NuGetPackageRoot)sn\$(SNVersion)\sn.exe</SNBinaryPath> |
63 | 63 |
|
64 | 64 | <!-- .pkgs and .app bundle tooling is only available on MacOS --> |
65 | 65 | <PkgToolPath Condition="$([MSBuild]::IsOSPlatform('OSX'))">$(NuGetPackageRoot)microsoft.dotnet.macospkg.cli\$(MicrosoftDotNetMacOsPkgVersion)\tools\$(NetToolCurrent)\any\Microsoft.Dotnet.MacOsPkg.Cli.dll</PkgToolPath> |
66 | 66 | </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> |
101 | 67 |
|
102 | | - <Target Name="Sign"> |
103 | 68 | <Error Condition="'$(AllowEmptySignList)' != 'true' AND '@(ItemsToSign)' == ''" |
104 | 69 | Text="List of files to sign is empty. Make sure that ItemsToSign is configured correctly." /> |
105 | 70 |
|
| 71 | + <PropertyGroup Condition="$(_DotNetCoreRequired)"> |
| 72 | + <_DotNetCorePath>$(DotNetTool)</_DotNetCorePath> |
| 73 | + </PropertyGroup> |
| 74 | + |
106 | 75 | <!-- Keep TarToolPath TFM in sync with TarTool project TFM. --> |
107 | 76 | <Microsoft.DotNet.SignTool.SignToolTask |
108 | 77 | DryRun="$(_DryRun)" |
|
117 | 86 | FileExtensionSignInfo="@(FileExtensionSignInfo)" |
118 | 87 | TempDir="$(ArtifactsTmpDir)" |
119 | 88 | LogDir="$(ArtifactsLogDir)" |
120 | | - DotNetPathMicroBuild="$(_DotNetPathMicroBuild)" |
121 | | - DotNetPathTooling="$(DotNetTool)" |
| 89 | + DotNetPath="$(_DotNetCorePath)" |
122 | 90 | SNBinaryPath="$(SNBinaryPath)" |
123 | 91 | MicroBuildCorePath="$(NuGetPackageRoot)microsoft.visualstudioeng.microbuild.core\$(MicrosoftVisualStudioEngMicroBuildCoreVersion)" |
124 | 92 | Wix3ToolsPath="$(WixInstallPath)" |
|
130 | 98 | DotNetTimeout="$(SignToolDotNetTimeout)" |
131 | 99 | MSBuildVerbosity="$(SignToolMSBuildVerbosity)" /> |
132 | 100 | </Target> |
| 101 | + |
133 | 102 | </Project> |
0 commit comments