|
| 1 | +<Project Sdk="Microsoft.NET.Sdk"> |
| 2 | + <PropertyGroup> |
| 3 | + <TargetFramework>net10.0</TargetFramework> |
| 4 | + <!-- Determine repository root when the pipeline variables are unavailable (e.g. local invocations). --> |
| 5 | + <_RepoRoot Condition="'$(RepoRoot)' != ''">$(RepoRoot)</_RepoRoot> |
| 6 | + <_RepoRoot Condition="'$(_RepoRoot)' == ''">$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)..\..\..\'))</_RepoRoot> |
| 7 | + |
| 8 | + <!-- Allow callers to override these directories; fall back to repo-relative defaults. --> |
| 9 | + <PackagesDir Condition="'$(PackagesDir)' == ''">$(_RepoRoot)artifacts\packages\Release\</PackagesDir> |
| 10 | + <IntermediateOutputPath Condition="'$(IntermediateOutputPath)' == ''">$(_RepoRoot)artifacts\obj\Sign\</IntermediateOutputPath> |
| 11 | + <LogDir Condition="'$(LogDir)' == ''">$(_RepoRoot)artifacts\log\Sign\</LogDir> |
| 12 | + |
| 13 | + <!-- SignTool requires explicit dotnet path; default to repo-local SDK. --> |
| 14 | + <DotNetPath Condition="'$(DotNetPath)' == ''">$(_RepoRoot).dotnet\dotnet.exe</DotNetPath> |
| 15 | + |
| 16 | + <MicroBuild_DoNotStrongNameSign>true</MicroBuild_DoNotStrongNameSign> |
| 17 | + <MicroBuild_SigningEnabled>true</MicroBuild_SigningEnabled> |
| 18 | + </PropertyGroup> |
| 19 | + |
| 20 | + <Import Project="$(NuGetPackageRoot)microsoft.dotnet.signtool\$(MicrosoftDotNetSignToolVersion)\build\Microsoft.DotNet.SignTool.props" /> |
| 21 | + |
| 22 | + <ItemGroup> |
| 23 | + <FileExtensionSignInfo Include=".nupkg" CertificateName="NuGet" /> |
| 24 | + <FileExtensionSignInfo Include=".dll" CertificateName="Microsoft400" /> |
| 25 | + <FileSignInfo Include="Microsoft.Dotnet.Installation.dll" CertificateName="Microsoft400" /> |
| 26 | + <FileSignInfo Include="Microsoft.Dotnet.Installation*.nupkg" CertificateName="NuGet" /> |
| 27 | + <ItemsToSign Include="$(PackagesDir)**\Microsoft.Dotnet.Installation*.nupkg"> |
| 28 | + <Authenticode>NuGet</Authenticode> |
| 29 | + </ItemsToSign> |
| 30 | + </ItemGroup> |
| 31 | + |
| 32 | + <PropertyGroup Condition="'$(SignType)' == ''"> |
| 33 | + <SignType>test</SignType> |
| 34 | + <TestSign>true</TestSign> |
| 35 | + </PropertyGroup> |
| 36 | + |
| 37 | + <PropertyGroup Condition="'$(TestSign)' == ''"> |
| 38 | + <TestSign>false</TestSign> |
| 39 | + </PropertyGroup> |
| 40 | + |
| 41 | + |
| 42 | + <Target Name="Sign" AfterTargets="Build"> |
| 43 | + <Microsoft.DotNet.SignTool.SignToolTask |
| 44 | + DryRun="false" |
| 45 | + TestSign="$(TestSign)" |
| 46 | + ItemsToSign="@(ItemsToSign)" |
| 47 | + FileSignInfo="@(FileSignInfo)" |
| 48 | + FileExtensionSignInfo="@(FileExtensionSignInfo)" |
| 49 | + TempDir="$(IntermediateOutputPath)" |
| 50 | + LogDir="$(LogDir)" |
| 51 | + DoStrongNameCheck="false" |
| 52 | + DotNetPath="$(DotNetPath)" |
| 53 | + MicroBuildCorePath="$(NuGetPackageRoot)microsoft.visualstudioeng.microbuild.core\$(MicrosoftVisualStudioEngMicroBuildCoreVersion)" |
| 54 | + SNBinaryPath="$(NuGetPackageRoot)sn\$(SNVersion)\sn.exe" |
| 55 | + > |
| 56 | + </Microsoft.DotNet.SignTool.SignToolTask> |
| 57 | + </Target> |
| 58 | +</Project> |
0 commit comments