This article is a personal blog backup article, the original address:
http://validvoid.net/visual-studio-pfx-import/
Import Key
When you use Visual Studio production projects, items that are signed with a PFX key may experience the following issues:
Unable to import the following key file: ****.pfx, the key file may be password protected. To correct this problem, try importing the certificate again, or manually install the certificate to a strong name with the following key container name csp:vs_key_****************
Cannot import the following key file: ****.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 F Ollowing key Container name:vs_key_****************
In this case, just follow the prompts to import the key, the specific steps are:
Start the Visual Studio command prompt
English: Starting with Microsoft Visual Studio 201*->visual studio Tools, Visual Studio command Prompt (201*)
English:start, Visual Studio Tools, Developer Command Prompt for vs201*, Microsoft Visual Studio 201*
Navigate to the directory where the. pfx file is located in the command prompt
At the command prompt, entersn -i \*\*\*\*.pfx VS\_KEY\_\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
For example:sn -i xxxx.pfx VS_KEY_791BAAE3DF288545
- Enter the password for the. PFX key file to complete the import
You should be able to build your project correctly in Visual Studio after you complete the import.
Re-import the key
Sometimes, when Visual Studio requires that you import a key and perform the above import step, you get the following error:
Failed to install key pair--Object already exists
You can then Visual Studio 命令提示
remove the imported key by executing the following command in to re-import:
sn -d VS\_KEY\_\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
After the key deletion is successful, the key can be re-imported through the above import steps.
If you get the following error when you delete the key:
Container does not exist
Container does not exist
This is due to the fact that another account in the system has already imported the key and cannot be removed from the current account. You can try to remove the key by logging in to the user account that you previously imported the key to, and then switch to the account where you want to build the project to re-import the key.
The solution that Visual Studio requires to import the PFX key and still require import after import