I installed the key pair into the key container. I am then able to build. If I restart the computer, then I get the error again.
(ResolveKeySource target) ->
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(3222,5): error MSB3325: Cannot import the following key file: jmr-Digicert-2020-NoChain.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_17C40AADFD2DB0A9 [C:\Source\RsyncNet\NetSync.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(3222,5): error MSB3321: Importing key file "jmr-Digicert-2020-NoChain.pfx" was canceled. [C:\Source\RsyncNet\NetSync.csproj]
The solution, at least until I restart the computer, is to open an administrative command prompt and enter these commands:
"C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.7.2 Tools\x64\sn.exe" -d VS_KEY_XXXXXXXXXXXXXXXXX
"C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.7.2 Tools\x64\sn.exe" -i "C:\Documents\Signing\mycert.pfx" VS_KEY_XXXXXXXXXXXXXXXXX
The first command deletes the existing key, required, as it is there, while the second line adds the key. I get prompted to enter the password. After that the solution builds.
FYI: -i option: Install key pair from <infile> into a key container named <container>.
The Visual Studio version makes no difference, as I had the same problem with VS2017.
Thoughts?