|
| 1 | +<!-- |
| 2 | + Code signing of .nupkg's built on Linux/macOS cannot be code-signed on the same machine which built the package. |
| 3 | + This project takes as inputs a folder of *.nupkg packages and code signs them using MicroBuild. |
| 4 | +
|
| 5 | + Note: because Authenticode signing of .dll's is not something Linux and macOS can verify anyways, this signing |
| 6 | + process only code-signs the .nupkg itself, not the contents. |
| 7 | +--> |
| 8 | +<Project DefaultTargets="AfterBuild" InitialTargets="CheckForRequiredProperties"> |
| 9 | + <PropertyGroup> |
| 10 | + <SignType>$([MSBuild]::ValueOrDefault($(SignType),'real'))</SignType> |
| 11 | + </PropertyGroup> |
| 12 | + |
| 13 | + <Import Project="..\..\..\Directory.Build.props" /> |
| 14 | + <Import Project="..\..\targets\MicroBuild.Plugin.props" Condition="'$(MicroBuildSentinelFile)' == ''" /> |
| 15 | + <Import Project="$(MicroBuildPluginDirectory)\MicroBuild.Plugins.*\**\build\MicroBuild.Plugins.*.props" Condition=" '$(MicroBuildPluginDirectory)' != ''" /> |
| 16 | + |
| 17 | + <PropertyGroup> |
| 18 | + <OutDir>$(RepositoryRoot)bin\$(MSBuildProjectName)\</OutDir> |
| 19 | + <IntermediateOutputPath>$(RepositoryRoot)obj\$(MSBuildProjectName)\</IntermediateOutputPath> |
| 20 | + </PropertyGroup> |
| 21 | + |
| 22 | + <ItemGroup Condition="'$(DirectoryToSign)' != ''"> |
| 23 | + <SymbolsPackages Include="$([MSBuild]::NormalizeDirectory($(DirectoryToSign)))**\*.symbols.nupkg" /> |
| 24 | + <FilesToSign Include="$([MSBuild]::NormalizeDirectory($(DirectoryToSign)))**\*.nupkg"> |
| 25 | + <Authenticode>$(PackageSigningCertName)</Authenticode> |
| 26 | + </FilesToSign> |
| 27 | + </ItemGroup> |
| 28 | + |
| 29 | + <Target Name="CheckForRequiredProperties"> |
| 30 | + <Error Text="Missing required property: DirectoryToSign" Condition="'$(DirectoryToSign)' == ''"/> |
| 31 | + <Error Text="Missing required property: PackageSigningCertName" Condition="'$(PackageSigningCertName)' == ''"/> |
| 32 | + <Error Text="Could not find any packages to sign in $(DirectoryToSign)" Condition="@(FilesToSign->Count()) == 0"/> |
| 33 | + </Target> |
| 34 | + |
| 35 | + <!-- MicroBuild code-signing chains onto this target. --> |
| 36 | + <Target Name="AfterBuild" /> |
| 37 | + <Import Project="$(MicroBuildPluginDirectory)\MicroBuild.Plugins.*\**\build\MicroBuild.Plugins.*.targets" Condition=" '$(MicroBuildPluginDirectory)' != ''" /> |
| 38 | +</Project> |
0 commit comments