VS2012 .NET 4.0的ClickOnce VSTO CryptographicException:SignatureDescription不能对提供的签名算法创建能对、算法、NET、Clic

2023-09-03 17:48:09 作者:再见是否如初

我有,我希望迁移到VS2012(但保持它在.NET 4.0中)一个VS2010 .NET 4.0 VSTO的Outlook加载项项目。它编译罚款,并运行从IDE就好了里面,但是当我尝试运行已发布的ClickOnce安装程序,我得到以下异常:

I have a VS2010 .NET 4.0 VSTO Outlook Addin project that I wish to migrate to VS2012 (but keep it in .NET 4.0). It compiles fine, and runs from inside the IDE just fine, but when I attempt to run the published ClickOnce installer, I get the following exception:

System.Deployment.Application.InvalidDeploymentException:异常   读取文件清单://MyPath/MyAddIn.vsto:清单可能不   是无效或无法打开该文件。       ---> System.Deployment.Application.InvalidDeploymentException:清单XML签名是无效的。       ---> System.Security.Cryptography.CryptographicException:SignatureDescription无法为签名算法创建   提供。

System.Deployment.Application.InvalidDeploymentException: Exception reading manifest from file://MyPath/MyAddIn.vsto: the manifest may not be valid or the file could not be opened. ---> System.Deployment.Application.InvalidDeploymentException: Manifest XML signature is not valid. ---> System.Security.Cryptography.CryptographicException: SignatureDescription could not be created for the signature algorithm supplied.

根据我的测试和在线调查(here和有),看来,仅仅有VS2012安装在我的机器上(我无论是从VS2010或VS2012发布)强制的ClickOnce安装程序的需要的一个SHA1证书时使用.NET 4.0。使用VS​​2010编译的时候,我现有的SHA256证书工作完全正常使用.NET 4.0(没有的VS2012安装)。

Based on my tests and online research (here and there), it appears that just having VS2012 installed on my machine (whether I publish from VS2010 or VS2012) forces the ClickOnce installer to require a SHA1 certificate when using .NET 4.0. My existing SHA256 certificate works perfectly fine with .NET 4.0 when compiled using VS2010 (without VS2012 installed).

在我不能升级客户端.NET 4.5,因为这是一个VSTO40项目(运行在XP / Office 2007的)。 在我无法卸载VS2012 / .NET 4.5在本地计算机上,因为我需要它的其他项目。 在我不行的轻松的从SHA256降级我的证书SHA1。 I can't upgrade clients to .NET 4.5 because this is a VSTO40 project (runs on XP/Office 2007). I can't uninstall VS2012/.NET 4.5 on local machine because I have other projects that need it. I can't easily downgrade my certificate from SHA256 to SHA1.

还有没有其他的建议,让我继续前进?

Are there any other suggestions to allow me to move forward?

推荐答案

我通过创建用于签署的ClickOnce清单的新证书解决我的问题和产生它使用SHA1算法。你可以在这里看到的对话:http://social.msdn.microsoft.com/Forums/en-US/winformssetup/thread/eba424ae-f7b7-4530-bb68-db3b9972a31e

I solved my problem by creating a new certificate that is used to sign the ClickOnce manifest and generated it using the SHA1 algorithm. You can see the conversation here: http://social.msdn.microsoft.com/Forums/en-US/winformssetup/thread/eba424ae-f7b7-4530-bb68-db3b9972a31e

修改2014年 - 8 - 05: 的Visual Studio 2013更新3终于解决了这个问题。 http://support.microsoft.com/kb/2933779 从修复的问题 - >常规的:

Edit 2014-Aug-05: Visual Studio 2013 Update 3 finally fixes this problem. http://support.microsoft.com/kb/2933779 From Fixed Issues -> General:

您可以使用SHA 256 code-签名证书,甚至应用   针对.NET框架4.0或更早版本。在这之前   更新时,.NET Framework 4.5必须$客户端页上$ psent   当SHA 256 code-签名证书被用于台式电脑   使用ClickOnce或Visual Studio工具发布的应用程序   Office加载项。如果您在使用SHA 256 code-签名证书   过去,与所看到的错误,例如该应用程序是不正确   格式化,该清单可能无效,清单XML签名   是无效的,或的SignatureDescription无法为创建   签名算法提供的,的此更新解决的问题   重新发布和新发布的应用程序。

You can use SHA 256 code-signing certificates even for applications that target the .NET Framework 4.0 or an earlier version. Before this update, the .NET Framework 4.5 had to be present on the client computer when a SHA 256 code-signing certificate was used for desktop applications published with ClickOnce or Visual Studio Tools for Office add-ins. If you have used SHA 256 code-signing certificates in the past, and have seen errors such as "The application is improperly formatted," "The manifest may not be valid," "Manifest XML signature is not valid," or "SignatureDescription could not be created for the signature algorithm supplied," this update resolves the problem for re-published and newly-published applications.