无法 运行 Excel VSTO 加载项

Unable to run Excel VSTO Add-ins

尝试 运行 一个 Excel 2013 VSTO 加载项项目,但我不断收到一条错误消息:

"System.Security.SecurityException: The solution cannot be installed because it is signed by a publisher whom you have not yet chosen to trust. If you trust the publisher, add the certificate to the Trusted Publisher list."

该项目有一个带有签名算法 sha256RSA 的密钥文件和 to/by Windows 用户颁发的证书。

知道如何解决这个问题吗?

尝试帖子中的解决方案 here

至于我自己,我开发了一个 Excel VSTO AddIn,它带有一个自签名的不受信任的证书,该证书由自定义 Setup.exe 提供,然后安装在属于某个端的机器上-用户。我无法控制这些机器,因为最终用户只是从 public 网站下载我的 Setup.exe。设置后 .vsto 的路径是本地文件路径,因此我不需要 Web 服务器作为主机。

在我的例子中,以下代码(放在我的 Setup.exe 中)足以成功信任 Excel VSTO:

UserInclusionList.Add(new AddInSecurityEntry(new Uri(vstoFilePath),
    "<RSAKeyValue><Modulus>...</Modulus><Exponent>...</Exponent></RSAKeyValue>"));

对应的<RSAKeyValue>可以在你的.vsto文件中找到。