I have 2 different versions of the same project on my machine. One from the code trunk, and the other from a code branch. These projects use a .pfx key to enable strong naming. When I first tried to compile the trunk version of the project I get the following error:
Cannot import the following key file: sgKey.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_45891C38BC1BB345
To resolve this I use sn.exe with the following command:
sn -i sg Key.pfx VS_KEY_45891C38BC1BB345
This resolves the issue with the trunk project, which then happily builds.
However, when I try to build the branch version of the project, I receive the same initial error (with the same key container name), and when I try install the certificate using the sn.exe it (not surprisingly) gives the following error:
Failed to install key pair -- Object already exists
This makes sense in that I used the same infile and container on the sn command, but what I am trying to understand is:
- If this object already exists, why is the project failing to build, as it would appear the certificate is already installed.
- How I resolve this (e.g. can I uninstall and then reinstall? and if so, how?)