Cannot import the following key file fix

This one has caused me a few hours of pain….a couple of times.  It is about time I document how I fixed it.

The Error:

Cannot import the following key file: <filename>.pfx. 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_ E2AEBF22AB52DD08    <Application Name>

The Fix:

  1. Open Visual Studio Command Prompt (It can be found in the Windows Start menu)
  2. Type sn -i “c:\Pathtofile\<filename>.pfx” TVS_KEY_ E2AEBF22AB52DD08
  3. Reimport the pfx file into Visual Studio

The sn.exe with the –i parameter, installs a key pair from <infile> into a key container named <container>.

6 comments

  1. Other very easy solutions depending on cause:
    – Change password of PFX to original password
    – Import the file by right clicking and following the instructions

  2. I’ve run into this a couple times as well. It never says VS_KEY for me. The solution that worked for me is right-clicking on the pfx and importing it with its password. Thanks for pointing that out, Markus.

  3. Pingback: Wentz Wu

Leave a Reply