问题
I develop VSTO solutions for Word and Excel. Since yesterday, for no apparent reason, I am now unable to debug any of my solutions. I face the same symptoms even when I try to debug a new blank VSTO project.
When the add-in launches (typically at Excel or Word startup), the following shows up:
System.Security.SecurityException: Customized functionality in this application will not work because the certificate used to sign the deployment manifest for ExcelAddIn1 or its location is not trusted. Contact your administrator for further assistance.
This happens with both Word and Excel. I debug from Visual Studio 2017, under Windows 10 and Office 365 (click-to-run version). Is this a problem with VS2017 not properly registering the test certificate? or maybe a problem with my Windows configuration (certificates inclusion list, etc)?
UPDATE
Updating and repairing Visual Studio 2017 did not have any effect. Installing VS2019 and testing with new blank Excel VSTO Add-in did not have any effect. Publishing that blank add-in using an EV Code signing certificate (from Sectigo, still valid and used many times in the past) does also produce the same problem.
I now suspect this might be due to the deployment manifest zoning. How can I investigate what is the registered location for the manifest, and what is its "effective" location? So that I can verify if both match.
回答1:
Try to Install your Certificate into:
- Trusted Publishers Store (Current User).
- Trusted Root Certification Authorities Store (Current User).
Go to Visual Studio, open Project Properties, choose Signing, hit Select form Store.... Hit Click here to view certificate properties and then Install Certificate. Choose Current User, then Place all certificates in the following store, browse Trusted Publishers, hit OK, and Finish. Repeat the above for the Trusted Root Certification Authorities store.
Once the installation is completed, rebuild your project.
回答2:
The registry keys were set to the settings as described here: Disable the inclusion list.
Changing these setting to Enable the Inclusion list did fix my problem.
The reasons why this got changed do still remain a great mystery... Windows update?
来源:https://stackoverflow.com/questions/59440211/test-certificate-not-trusted