Skip to content

Commit 8bedc10

Browse files
authored
Sign Microsoft.Installation library package (#51488)
2 parents 72f4fb4 + 26c8a18 commit 8bedc10

File tree

2 files changed

+62
-2
lines changed

2 files changed

+62
-2
lines changed

eng/pipelines/templates/jobs/dnup/dnup-library-package.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ jobs:
4444
targetPath: '$(Build.SourcesDirectory)/artifacts/packages/Release/NonShipping/'
4545
artifactName: 'dnup-library-packages'
4646
publishLocation: Container
47-
4847
steps:
4948
- ${{ if eq(parameters.pool.os, 'windows') }}:
5049
- powershell: |
@@ -54,5 +53,8 @@ jobs:
5453
& .\.dotnet\dotnet build test\dnup.Tests\dnup.Tests.csproj -c Release
5554
displayName: 💻 Build Windows
5655
- powershell: |
57-
& .\.dotnet\dotnet pack .\src\Installer\Microsoft.Dotnet.Installation\Microsoft.Dotnet.Installation.csproj
56+
& .\.dotnet\dotnet pack .\src\Installer\Microsoft.Dotnet.Installation\Microsoft.Dotnet.Installation.csproj
5857
displayName: 📦 Package dnup library
58+
- powershell: |
59+
& .\.dotnet\dotnet build .\src\Installer\Microsoft.Dotnet.Installation\Microsoft.Dotnet.Installation.sign.proj /t:Sign
60+
displayName: 🖋️ Sign dnup library packages with arcade signtool
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
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

Comments
 (0)