I cannot build projects with a strong name key signing - the message in the title always comes up.
Yes the project was initially copied over from another machine. However even if I add a new key via the Signing tab in Project Properties, this error is still shown.
I have tried running Visual Studio as an Administrator and have tried manually adding the keys to Windows Certificate Store.
Help!
Edit: I don't get this error with a new project, but I'd quite like to get this existing project working. It won't work even if I create a new certificate!
I've finally found the solution.
Edit the .csproj file for the project in question. Delete the following lines of code:
Go to your project's "Properties" within visual studio. Then go to signing tab.
Then make sure Sign the Click Once manifests is turned off.
Updated Instructions:
Within your Solution Explorer:
right click on your project click on properties usually on the left-hand side, select the "Signing" tab check off the Sign the ClickOnce manifests Make sure you save!
https://i.stack.imgur.com/FIHjg.png
It's simple!!
I resolved this problem by following this steps:
Open project properties Click on Signing Tab And uncheck "Sign the assembly"
That's it!!
Open the .csproj file in Notepad. Delete the following information related to signing certificate in the certificate store
Try this:
Right click on your project → Go to properties → Click signing which is left side of the screen → Uncheck the Sign the click once manifests → Save & Build
Go to your projects "Properties" within visual studio. Then go to signing tab.
Then make sure Sign the Click Once manifests is turned off.
OR
1.Open the .csproj file in Notepad.
2.Delete the following information related to signing certificate in the certificate store xxxxx xxxxxx xxxxxxxx.pfx true false `
Worked for me.
https://i.stack.imgur.com/ZJzee.jpg
It is not enough to manually add keys to the Windows certificate store. The certificate only contains the signed public key. You must also import the private key that is associated with the public key in the certificate. A .pfx file contains both public and private keys in a single file. That is what you need to import.
You said you copied files from another computer. After you copied them, did you 'Unblock' them? Specifically the .snk file should be checked to make sure it is not marked as unsafe.
To sign an assembly with a strong name using attributes
Open AssemblyInfo.cs
(in $(SolutionDir)\Properties
)
the AssemblyKeyFileAttribute
or the AssemblyKeyNameAttribute
, specifying the name of the file or container that contains the key pair to use when signing the assembly with a strong name.
add the following code:
[assembly:AssemblyKeyFileAttribute("keyfile.snk")]
If you need just build the project or solution locally then removing the signing might be a dead simple solution as others suggest.
But if you have this error on your automation build server like TeamCity where you build your actual release pieces for deployment or distribution you might want to consider how you can get this cert properly installed to the cert store on the build machine, so that you get a signed packages at the end of the build.
Generally it is not recommenced to check-in/commit any PFX certificates into source control, so how you get this files on your build server during the build process is a bit another question, but sometimes people do have this file stored along with the solution code, so you can find it in the project folder.
All you need to do is just install this certificate under proper account on your build server.
Download PsExec from Windows Sysinternals. Open a command prompt, and enter the following. It will spawn a new command prompt, running as Local System (assuming that your TeamCity is running under the default Local System account): > psexec.exe -i -s cmd.exe In this new command prompt, change to the directory containing the certificate and enter the filename to install (change the name of the file to yours): > mykey.pfx The Import Certificate wizard will start up. Click through and select all the suggested defaults. Run the build.
All credits goes to Stuart Noble (and then further to Laurent Kempé I believe ☺).
Just ran into this (again), due to PFX cert not being included in the code, for security.
For local testing, like Debug builds, the lead programmer of this solution had me go into Properties, Signing, click on "Create Test Certificate". In our setting he said just click ok, but one can put in a strong password here if warranted/needed.
Success story sharing
ManifestCertificateThumbprint
andManifestKeyFile
solve the problem.