views:

1240

answers:

4

I have a VS 2008 ClickOnce solution that I am attempting to compile with "Sign Manifest" turned on.

With this option checked, I am prompted for my PFX's password, and upon entering the correct password I receive the error: "Error Importing Key" / "Object already exists".

I'm sure I've hosed something.

I've tried to run the "CERTUTIL -importPFX -user .pfx AT_SIGNATURE" to no avail.

A: 

I too am currently having difficulty with this. My situation is somewhat different to this in that I am attempting to generate a strong-name key file for my assembly

I haven't yet solved the issue but I believe it is caused because, for whatever reason the key already exists in the key store for the CSP used to generate the key. Why the key already exists, I don't know, nor have I found a way to remove it but I will update this question when I do

Crippledsmurf
+3  A: 

I don't know if this will help for this problem, but I had something similar after a Vista to Windows 7 upgrade, and simply had to change permissions on the MachineKeys folder (C:\Documents and Settings\All Users\ApplicationData\Microsoft\Crypto\RSA\ in Windows 7)

See here: http://stackoverflow.com/questions/1341108/certificate-problem-error-importing-key-object-already-exists-after-windows-7/1341619#1341619

Let me know if this was helpful :)

This is IMHO the best answer, since it doesn't force you to run the entire Visual Studio IDE as administrator, which can hose other things. (for example, if you want to debug your application like a regular user, as you normally want to do)
Jonas
A: 

Just wanted to add my own experience with this problem.

Mine came suddenly after doing a bunch of system-type changes... one of them being switching on Vista UAC to test the app I am working on.

Ran into this exact problem and it wouldn't compile. I'm freaking out...

... fixing the permissions seems on the ...\RSA\MachineKeys folder seems to have made the problem go away but looking at its permissions and noticing that devenv.exe (the VS IDE) was not told to "Run as Administrator" it is possible that this issue may be caused by UAC restrictions.

I hate the pseudo-admin mode in Vista....

Tom the Junglist
+1  A: 

I had the same problem. Starting Visual Studio with 'Run as Administrator' solved the issue.

Bart Roozendaal