The following key file could not be imported: ****.pfx, the key file may be password protected. To correct this problem...

["Reprint link"]

=====================================Reprint link ============ =========================

 

["Generation error!!!"]

The following key file could not be imported: **** .pfx, the key file may be password protected.
To correct this, try importing the certificate again, or manually install the certificate to a strong name CSP with the following key container name: VS_KEY_ ****************

 

["Here's everyone's favorite solution segment"]

1. Start Visual Studio Command Prompt
[
    {
        " Pre-Visual Studio 2015 " :[
            {
                " Chinese version " : " Start -> Microsoft Visual Studio 2015 ->Visual Studio Tools ->Visual Studio Command Prompt (201*) "
            },
            {
                "English":"Start->Microsoft Visual Studio 201*->Visual Studio Tools->Developer Command Prompt for VS201*"
            }
        ]
    },
    {
        "Visual Studio 2015":[
            {
                " Chinese version " : " Start -> Visual Studio 2015 (folder) -> Visual Studio Command Prompt (2015) "
            },
            {
                "English":"Start -> Visual Studio 2015(Folder) -> Developer Command Prompt for VS2015"
            }
        ]
    }
]

--------------------------------------------------------------------------------------------

2. Navigate to the directory where the .pfx file is located in the command prompt
{
" For example, your directory is in the C drive " :
 " C: " 
}

--------------------------------------------------------------------------------------------

3. In the command prompt enter sn -i ****.pfx VS_KEY_**************** 
{
"eg":
"sn -i xxxx.pfx VS_KEY_791BAAE3DF288545"
}

--------------------------------------------------------------------------------------------

4. Enter the password of the .pfx key file to complete the import

--------------------------------------------------------------------------------------------

After importing, you should be able to build the project normally in Visual Studio.

Re-import the key (actually I didn't come across it...)

*SomeTimes
{
" Sometimes I get the following error when Visual Studio asks to import the key and I do the above import step " :
 " Failed to install key pair -- Object already exists "
}
*Then
{
" In this case, you can remove the imported key by executing the following command in the Visual Studio Command Prompt so that it can be re-imported " :
 " sn -d VS_KEY_**************** "
}
* 
[ "The key can be re-imported through the above import steps after the key is deleted successfully " ]

*If
{
" If you get the following error when deleting the key " :
 " Container does not exist " 
}

This is because the key has been imported to another account in the system and cannot be removed from the current account.

You can try to log in to the user account that imported the key earlier to remove the key,

Then switch to the account where you want to build the project and re-import the key.

x

Summarize

Thanks to the original author, the style of the reprinted article is also my favorite, it feels very clean...

In fact, I also wanted to make the style more refreshing, so I went crazy and used some JSON strings... poof...

x

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325685078&siteId=291194637