【发布时间】:2021-02-04 09:53:55
【问题描述】:
我有一个 VSTO 加载项,我正在从 VS2010 迁移到 Visual Studio 2019。但是,我忘记了附加到解决方案主项目的 mypfx 密钥的密码。
我现在正在尝试创建一个新密钥并将其导入我的项目以替换我不能再使用的旧密钥。我已经尝试了 stackoverflow 和其他网站上指示的后续步骤,但我在 VS2019 中不断收到以下构建错误:
Cannot import the following key file: newtest.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_10580C0D68F0E891 <project name>
但是,这正是我正在尝试的。首先,我按照here 所示创建一个新证书:
New-SelfSignedCertificate -DnsName "somename" -CertStoreLocation "cert:\LocalMachine\My"
然后我导出它:
$CertPassword = ConvertTo-SecureString -String “somepass” -Force –AsPlainText
Export-PfxCertificate -Cert cert:\LocalMachine\My\<somethumbprint> -FilePath <path>/newtest.pfx -Password $CertPassword
最后一步,如this question,是使用带有以下命令的sn.exe:
sn -i sg newtest.pfx VS_KEY_XXXXXXXXXXXX
命令运行成功,但是当我再次重启vs2019并打开插件解决方案时,再次弹出相同的错误。我能做什么?
编辑 此外,我无法取消选中 Project > Properties > Signing 中的“sign clickonce manifest”复选框。这意味着下面的答案中提到的 从商店选择 选项不可用。 我已将此项目移至另一台计算机,这可能是原因吗?
这里有点卡住了。
【问题讨论】:
标签: visual-studio visual-studio-2010 vsto visual-studio-2019