Skip to content

Instantly share code, notes, and snippets.

@NiKiZe
Created January 18, 2024 12:32
Show Gist options
  • Save NiKiZe/a46affda448a222bac617a1a2f8eba75 to your computer and use it in GitHub Desktop.
Save NiKiZe/a46affda448a222bac617a1a2f8eba75 to your computer and use it in GitHub Desktop.
Sign msbuild properly
<Target Name="_SignAssemblies" AfterTargets="Compile" DependsOnTargets="CreateSatelliteAssemblies;$(RazorCompileDependsOn)" Condition="'$(CertificateThumbprint)' != ''">
<ItemGroup>
<_AssembliesToSign Include="$(IntermediateOutputPath)$(TargetFileName)" />
<_AssembliesToSign Include="@(IntermediateSatelliteAssembliesWithTargetPath)" />
<_AssembliesToSign Include="@(RazorIntermediateAssembly)" />
</ItemGroup>
<Message Importance="high" Text="Signing assemblies: @(_AssembliesToSign)" />
<SignFile SigningTarget="%(_AssembliesToSign.Identity)" CertificateThumbprint="$(CertificateThumbprint)" TimestampUrl="$(TimestampUrl)"/>
</Target>
@NiKiZe
Copy link
Author

NiKiZe commented Jan 18, 2024

This is based on dotnet/msbuild#6788 but reusing CertificateThumbprint and TimestampUrl as already defined

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment