An error occurred while signing: Unknown error “-2147012894”

核能气质少年 提交于 2019-12-07 10:37:39

问题


I have .pfx certificate bought from https://www.globalsign.co.uk/. I've signed the ClickOnce manifest of my VSTO (Excel Add-In project type in Visual Studio) project with it and everything worked. After a month of use, I've tried to rebuilding my project (that used to work) and now it gives me an error:

An error occurred while signing: Unknown error "-2147012894"

The certificate is perfectly valid and not expired and signing manually like following works perfectly: SignTool sign /f mycert.pfx /p password somefile.exe

I've tried removing all of the certificates in certmgr.msc under the Personal/Certificates path, but it didn't help.

Anyone had this kind of error before? Any suggestions?


回答1:


Suprisingly the fix was easier than expected... I simply had to open the project file and remove all of the xml tags that were related to signing an assembly. So for example:

  <PropertyGroup>
    <SignManifests>true</SignManifests>
  </PropertyGroup>
  <PropertyGroup>
    <ManifestKeyFile>mycert.pfx</ManifestKeyFile>
  </PropertyGroup>
  <PropertyGroup>
    <ManifestCertificateThumbprint>AB3S6</ManifestCertificateThumbprint>
  </PropertyGroup>
  <PropertyGroup>
    <ManifestTimestampUrl>http://timestamp.globalsign.com/scripts/timstamp.dll</ManifestTimestampUrl>
  </PropertyGroup>

After, I've simply went to Signing tab and re-added the certificate. And this worked. Hopefully this will help someone in the future.




回答2:


I would guess that the certificate being used when you build your project is not the same one you are using when signing it manually, otherwise it would work.

Go to the project properties for your project and click on the Signing tab and take a look. If you still think it's right, click "select from file" and go pick the pfx file again to force a reload, and try it again.



来源:https://stackoverflow.com/questions/15141763/an-error-occurred-while-signing-unknown-error-2147012894

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!