Error: Cannot import the following key file

By | 6. October 2016

Sometimes it happens that opening signed project will end to error similar to this :

Error  Cannot import the following key file: Comodo_4.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_988E00BF5A2A00F7

For me this helped:

I was able to resolve the issue by running sn -i <KeyFile> <ContainerName> (installs key pair into a named container).

sn -i Comodo_4.pfx VS_KEY_988E00BF5A2A00F7

sn is usually installed as part of a Windows SDK.

Simplest way to access sn is  is to open Developer Command Prompt for Visual Studio.

For Windows 10

  1. Open the Start menu, by pressing the Windows logo key Windows logo on your keyboard for example.
  2. On the Start menu, enter dev. This will bring a list of installed apps that match your search pattern. If you’re looking for a different command prompt, try entering a different search term such as prompt.
  3. Choose the Developer Command Prompt (or the command prompt you want to use).

For other operating systems see https://msdn.microsoft.com/en-us/library/ms229859(v=vs.110).aspx

 

NB! update 17 Oct 2016

If you get on certificate registration error about duplicate key (already registered) then try to start Visual Studio in administrator mode.  The key might ne accessible only for admin.

 

 

 

 

Leave a Reply