HerrLoesch
HerrLoesch

Reputation: 1043

VSTO Click-Once Certificate breaks TFS 2015 build

I develop an Excel 2010 addin. Therefor I have a click-once installer with a corresponding certificate. Everything works fine on my machine but now I have to build it on a TFS 2015.

When ever the signing is switch on, I get messages telling me:

[error]C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets(2718,5): Error MSB3326: Cannot import the following key file: . The key file may be password protected. To correct this, try to import the certificate again or import the certificate manually into the current user's personal certificate store.

C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets(2718,5): error MSB3326: Cannot import the following key file: . The key file may be password protected. To correct this, try to import the certificate again or import the certificate manually into the current user's personal certificate store.

[error]C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets(2718,5): Error MSB3321: Importing key file "My CERT.pfx" was canceled.

If I have it switched off, then I get another message:

"C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\OfficeTools\Microsoft.VisualStudio.Tools.Office.targets(159,9): Error : Cannot build because the ClickOnce manifest signing option is not selected. To select this option, open the project property pages, click the Signing tab, and then select "Sign the ClickOnce manifests.""

In both ways the build breaks and I don't understand why. I even deleted the certificate and removed every bit of information about signing from the cproj file, without any success.

I would like to have a build without the signing. How can I achive thise?

Upvotes: 0

Views: 1337

Answers (2)

Rudra
Rudra

Reputation: 51

Recreating new .pfx file worked. Please make sure to add the newly generated pfx to your repository when committing the code.

Upvotes: 0

igor_1024
igor_1024

Reputation: 166

I had VSTO Outlook add-in working with TFS online fine until I renamed the add-in project and started to experience exactly the same build errors today.

Following steps helped me:

  1. Untick “Sign the ClickOnce manifests” and “Sign the assembly” options.
  2. Delete all pfx files from the project.
  3. Remove all manifest related tags from csproj.
  4. “Create Test Certificate” without entering anything into password boxes and choosing sha256RSA algorithm.
  5. Remove “*.pfx” files from .gitignore (I use GIT as source control).
  6. Tick “Sign the ClickOnce manifests” option.
  7. Check-in all changes together with new “…_TemporaryKey.pfx” file.

Now I only get following warning in TFS build logs, but at least the build doesn’t fail anymore :-)

“warning MSB3327: Unable to find code signing certificate in the current user's Windows certificate store. To correct this, either disable signing of the ClickOnce manifest or install the certificate into the certificate store.”

I hope this will help you too!

Upvotes: 3

Related Questions