none
strong name problem - object already exists RRS feed

  • Question

  • I create a project in visual studio 2012 and get an error:

    Error 2 Cannot import the following key file: abc.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_9690F879800692AC 

    Then I run the SN utility from the VS2012 tools command line:

    sn -i c:\skydrive\c#\abc\abc.pfx VS_KEY_9690F879800692AC

    and get an error:
    Failed to install key pair -- Object already exists.

    What to do?

    I looked at the options of SN and do not see an option to replace an existing object.

    I setup this new laptop yesterday. Using skydrive to sync with my office PC. Yesterday I ran the SN utility and the key was accepted. Today I build the project on the laptop and get the "can't import the key" error. Then I run SN again and get this "object already exists" error.

    thanks,

    Thursday, June 13, 2013 12:33 PM

Answers

  • I suspect you may be confusing "signing" with "strong naming". Unfortunately people use "sign" loosely.

    sn.exe is for strong naming assemblies using snk files.

    pfx files are used for certificate signing of files, and signtool is used in that context. If you search for -signtool pfx- you'll see what I mean.


    Phil Wilson

    • Marked as answer by Steve Richter Sunday, June 16, 2013 10:17 PM
    Thursday, June 13, 2013 8:49 PM

All replies

  • I suspect you may be confusing "signing" with "strong naming". Unfortunately people use "sign" loosely.

    sn.exe is for strong naming assemblies using snk files.

    pfx files are used for certificate signing of files, and signtool is used in that context. If you search for -signtool pfx- you'll see what I mean.


    Phil Wilson

    • Marked as answer by Steve Richter Sunday, June 16, 2013 10:17 PM
    Thursday, June 13, 2013 8:49 PM
  • I just had this happen to me and I found that the problem was that I installed the key previously as administrator, then I was running VS not as administrator.  So I deleted the container using sn -d from admin command prompt, re-installed it from a non-admin command prompt, and now VS is happy.
    Sunday, January 12, 2014 11:11 PM
    Moderator