如何将本地发布的Excel JS Addin从Trusted Addin catalogue加载至Excel Desktop App?
Great question—yes, it’s absolutely possible to run your Excel Add-in entirely offline using a locally published folder, but it sounds like you’re hitting a few common pitfalls with URI formatting, manifest configuration, or trusted directory setup. Let’s break this down step by step to get it working:
1. Fix the File URI Format
First, the path you mentioned (file///C:Users/User10/MyExcelAddin) is missing critical components that Excel needs to parse it correctly. A valid local file URI for Windows should follow this structure:
file:///C:/Users/User10/MyExcelAddin/taskpane.html
- Notice the three forward slashes after
file: - The drive letter must include a colon (
C:) - Use forward slashes for path separators (Windows accepts these natively in URIs)
2. Update Your Manifest’s SourceLocation
Instead of using an absolute file URI (which can break if you move the folder), a better approach is to use a relative path in your manifest. If your manifest file (*.xml) is in the same root folder as your taskpane.html (which it should be after publishing from VS), set the SourceLocation like this:
<SourceLocation DefaultValue="./taskpane.html" />
This tells Excel to load the task pane from the same directory as the manifest, which is far more reliable for offline setups.
If you do need an absolute URI for some reason, double-check that it matches the valid format above.
3. Configure Excel’s Trusted Add-in Catalog
This is where most people get stuck—you need to add your published folder to Excel’s trusted directories using a local system path, not a file URI:
- Open Excel, go to File > Options > Trust Center > Trust Center Settings > Trusted Add-in Catalogs
- In the Catalog Url field, paste the local folder path (e.g.,
C:\Users\User10\MyExcelAddin) - Check the box that says Show in Menu
- Click Add then OK, and restart Excel
After restarting, go to Insert > My Add-ins > Shared Folder—your add-in should appear here.
4. Validate Your Manifest
If Excel still doesn’t detect your manifest, it might have a syntax error. Use the Office Add-in Manifest Validator (included with Visual Studio) to check for issues:
- In VS, right-click your manifest file and select Validate
- Fix any errors it flags (common issues include invalid URIs, missing required nodes, or incorrect schema versions)
5. Check Folder Permissions
Make sure your published folder is in a location Excel can access without restrictions. Avoid system folders like Program Files (which require admin rights). Instead, use a user-owned folder like Documents\MyExcelAddins—this prevents permission blocks that can stop Excel from reading the manifest or add-in files.
Quick Note on VS Development vs Offline Loading
VS runs your add-in on a local development server (usually https://localhost:3000), which uses a different loading mechanism than the trusted catalog. The dev server handles URI routing and permissions automatically, so it doesn’t hit the same issues as a local file-based setup.
内容的提问来源于stack exchange,提问作者Konstantinos Cheilakos

