Error signing public key output from file "key.pfx" - the value does not fall into the expected range

I get the following error in VS2015 when trying to compile a C # project that uses code signing. I did not get this error in VS2013.

There is also no information about this error.

+5
source share
2 answers

I had this problem. You can open CommonAssemblyInfo.cs and delete the line [assembly: AssemblyKeyFile(@"C:\KeyFile.snk")] :)

+2
source

You can try overexposing your pfx and make sure the "Include all certificates" option is cleared to exclude the full certificate chain, which may cause some problems.

If this does not help use AssemblyKeyName ("xxx") instead of AssemblyKeyFile. The sn.exe -i key.pfx xxx command must be executed on your build server or development machine first to install the key in CSP. (I think your error message is caused only by the AssemblyKeyFile attribute.)

Let me note that there is no need to use your trusted certificate (signed by some certification authority) to sign (or strong name) the subscription. A strongly named assembly can be digitally signed for authentication / security purposes later.

This way you can also avoid the problem if you create a new key using the strong name tool:

sn -k keyPair.snk

and use the current .pfx only with, for example, SignTool.

0
source

All Articles