70
votes

I maintain a large WPF application which I inherited from another developer. I use ClickOnce to publish it. Suddenly, today I got an error message: Error 2 Cannot publish because a project failed to build. 1 1
Error 3 An error occurred while signing: Failed to sign bin\Debug\app.publish\setup.exe. SignTool Error: No certificates were found that met all the given criteria.

I do have a file called SomeName.snk, which is referred in project settings, Signing tab. I have no idea what happened today that caused the problem. I use VS 2012.

11
How did you get the full description of the error? I also use ClickOnce and Publish directly from within VS2019. I only get "An error occurred while signing: Failed to sign bin\Release\app.publish\\setup.exe." And my problem is probably not the due to a given certificate, as the same certificate works to sign the same project from other computers, and I also get the same error when using freshly generated test certificates. I never had any problem until today, for no apparent reason.Ama
@Ama Sorry, I don't remember. It was many years ago...David Shochet

11 Answers

61
votes

I'd check whether the certificate expired. Most (all?) certs have an expiration date.

204
votes

Go to main project properties > Signing > If the expiration date is over > click on Create Test Certificate, password is not mandatory, and you're done.

5
votes

I got this problem installing visual c++ on top of a VS2017 .net install. I solved it by unchecking Properties -> Security -> Enable ClickOnce security settings.

It then created an app.manifest file. After that the error went away. Interestingly enough, I checked it again to see what would happen and the problem did not come back.

4
votes

Did you check for the certificate?

View or manage your certificates

You can use the MMC Snap In or Internet Explorer.

4
votes

Go to main project properties > Signing > Select from Store...
Click certificate properties
And install certificate

4
votes

Go to Main project (Startup Project) and right click > properties Then go to Signing Then unchecked "Sign the ClickOnce manifests" It's work for me.

2
votes

I just ran into the problem today. In my particular case, it was caused by this Microsoft Windows Update.

I uninstalled that update and publish began working as it always had. This is only a temporary work around and means you should probably regenerate your keys/certificates.

2
votes

This happens mostly if your certificate for that particular project has expired or has some issues.

Right Click Project -> Properties -> Signing Tab -> More Details button -> Shows your certificate details. Check if your certificate has expired

Ways to Fix

1. Un-check the "Sign the ClickOnce manifests" and try

2. Extend the Certificate by creating a Test Certificate (If your certificate is expired)

  • Hit "Create Test Certificate..." button
  • Enter your credentials (Not mandatory)
  • Save

3. Re-validate your existing certificate (If your certificate is not expired)

  • Hit "Select from file" button and use your existing key file (eg. .pfx)

OR

  • Hit "Select from Store" button and select from the available options

Tip: If you still face issues building the project. Just restart your Visual Studio.

Hope that helps.

2
votes

I had this same issue and I was able to solve it by removing or changing the timestamp server URL. After removing that, the project was able to build successfully.

enter image description here

1
votes

In my case, the cert was not expired and none of the other solutions worked (restarting VS, using a temp test cert, restarting computer, etc.)

The issue was resolved by deleting my output directory and rebuilding.

0
votes

Simple Clean sorted it for me. Build - Clean Solution