Cannot load PFX key for assembly signing

murarialex's Avatar


05 Jun, 2020 11:18 PM


I'm trying to add a PFX key for strong-signing my .NET assemblies through Import-PfxCertificate, it's being imported correctly, but when MsBuild starts, it cannot load the certificate and gives the following message:
"The key file may be password protected. To correct this, try to import the certificate again or manually install the certificate to the Strong Name CSP with the following key container name: VS_KEY_689BEEB655EEA138".

But if it was imported correctly, why msbuild can't use it?

The build log:
The appveyor.yml file:


  1. Support Staff 1 Posted by Feodor Fitsner on 05 Jun, 2020 11:56 PM

    Feodor Fitsner's Avatar

    Never seen such an error before. Try looking via RDP how the cert is installed:

  2. 2 Posted by murarialex on 06 Jun, 2020 12:43 AM

    murarialex's Avatar

    After some more digging I fixed it by using this script:

    Loading PFX files isn't as simple as it should be.

    Apparently this problem has already popped up here some time ago:

    Strange to have to use such complicated scripts for trivial tasks like signing assemblies. Anyway, it's working now.

  3. Support Staff 3 Posted by Feodor Fitsner on 06 Jun, 2020 12:47 AM

    Feodor Fitsner's Avatar

    Maybe it depends on the certificate, as in our internal builds we are importing AppVeyor's signing certificate with just Import-PfxCertificate. However, we are signing with signtool.exe, not during the build, so this might be the difference as well.

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:


Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac