Sign .NET assemblies during build
Create a new file named Directory.Build.props
next to your .sln
file with the following content:
<Project>
<Target Name="SignIntermediateAssembly" BeforeTargets="GetCopyToOutputDirectoryItems" Condition="'$(SignAssemblies)' == 'True'">
<Exec Command="signtool.exe sign /v /n "Nefarius Software Solutions e.U." /tr http://timestamp.digicert.com /fd sha256 /td sha256 "%(IntermediateAssembly.FullPath)"" />
</Target>
</Project>
Add /p:SignAssemblies=True
to your build/publish command, e.g.:
dotnet build -c Release /p:Platform="Any CPU" /p:SignAssemblies=True