Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to work around the PFX signing not supported error when publishing .NET Core

I've been trying to sign assemblies with a PFX file. All worked fine, I accessed Properties/Signing at Visual Studio yet whenever I run the dotnet publish command, I get this error:

C:\Program Files\dotnet\sdk\2.1.201\Microsoft.Common.CurrentVersion.targets(3210,5): error PFX signing not supported on .NET Core

I've been looking for a way to work around this, yet with no luck so far.

like image 903
E.T. Avatar asked Jun 29 '18 16:06

E.T.


2 Answers

So I figured I should go with SNK signing instead of PFX, considering it's no longer supported by PFX.

like image 133
E.T. Avatar answered Nov 18 '22 14:11

E.T.


  1. Export public key from the PFX: sn -p key.pfx key.pub
  2. Enable delayed signing for your assembly by adding <DelaySign>true</DelaySign> to the project file or by AssemblyDelaySignAttribute. Use a public key from step 1 instead of the PFX for signing.
  3. Re-sign your assembly after build: sn -R assembly.dll key.pfx

https://learn.microsoft.com/en-us/dotnet/framework/tools/sn-exe-strong-name-tool

like image 28
k.rode Avatar answered Nov 18 '22 14:11

k.rode