I am developing an Excel Add-In using Visual Studio Community 2022. The project commenced in May using a VS Project Template (Excel Web Add-In C#) as a starting point. The project has always side-loaded to Excel (desktop version) and run without issues. Recently Excel has begun throwing the following error in the Taskpane when I attempt to run the project from the VS IDE; "ADD-IN ERROR. The content is blocked because it isn't signed by a valid security certificate."
I initially assumed this was a straightforward error that meant the self-signed cert installed by Visual Studio when I first created the project had expired and needed to be renewed. I have since attempted multiple solutions (details below) but the error persists.
I have attempted the following to correct this:
Approach 1 - Manually delete certs and create in Visual Studio.
- Opened Certificate Manager and deleted all references to localhost and Microsoft Development certificates from all nodes.
- Flushed browser cache.
- Rebooted machine.
- Reopened Visual Studio and ran the project.
- Visual Studio recreates the certs and prompts me to self certify them for IIS Express.
- Confirmed the self certification.
Results: Same error in Excel. Visual Studio does not prompt to self certify on subsequent attempts suggesting the certs were successfully trusted.
Approach 2 - use office-addin-dev-certs npm package to self sign.
Delete folder ".office-addin-dev-certs"
Installed most recent package "npm install office-addin-dev-certs --save-dev"
Create self signed localhost and CA certs "npx office-addin-dev-certs install"
Verified the install "npx office-addin-dev-certs verify"
Results of verify;
You have trusted access to https://localhost. Certificate: C:\Users\Lloyd.office-addin-dev-certs\localhost.crt Key: C:\Users\Lloyd.office-addin-dev-certs\localhost.key
Open Visual Studio and run project.
Results: Same error in Excel.
For good measure I have also tried deleting and reinstalling Office and have tried creating a new Excel Add-in from a code template with no customization.
Versions of components in use: Office 365: Version 2506 Build 16.0.18925.20076 64-bit Microsoft Visual Studio Community 2022: Version 17.14.8 Microsoft .NET Framework: Version 4.8.09032 ASP.NET and Web Tools 17.14.114.53116 Office Developer Tools for Visual Studio 17.10.35724.01
