Trusted location error in VSTO clickonce on network drive

Michael Andy Poulsen 0 Reputation points
2024-05-02T12:28:30.29+00:00

Hi,

We are publishing vsto-projects via clickonce and have started facing a problem when we references them as described here: https://learn.microsoft.com/en-us/visualstudio/vsto/deploying-an-office-solution-by-using-clickonce?view=vs-2022&tabs=csharp#to-update-the-_assemblylocation-property-in-a-document.

We add the properties _AssemblyLocation (pointing to a http-path) and _AssemblyName.

This works when the file is saved locally, but not on a network location (used to work). Currently the majority of the files are saved on network drives to be access by employees in different departments.

Adding the network drive as a trusted location is not allowed by our security department, and without this we get this error:

"

Microsoft.VisualStudio.Tools.Applications.Runtime.CannotCreateCustomizationDomainException: This document contains custom code that cannot be loaded because the location is not in your trusted locations list: test.xlsx. If you trust this document you can save and open it from a location on your computer. For more information, see http://go.microsoft.com/fwlink/?LinkId=99104.

at Microsoft.VisualStudio.Tools.Office.Runtime.RuntimeUtilities.VerifyDocumentIsTrusted(String documentFullLocation, String documentName, OfficeVersion officeVersion)

at Microsoft.VisualStudio.Tools.Office.Runtime.DomainCreator.GetAssemblyDataFromManifests(String solutionLocation, String manifestLocator, String documentName, Boolean showUIDuringDeployment, CustomizationType customizationType, OfficeVersion officeVersion, IHostServiceProvider interopServiceProvider)

at Microsoft.VisualStudio.Tools.Office.Runtime.DomainCreator.CreateCustomizationDomainInternal(String solutionLocation, String manifestName, String documentName, Boolean showUIDuringDeployment, IntPtr hostServiceProvider, Boolean useFastPath, IntPtr& executor)

"

It has been working for many years, but at some point some restrictions seems to have been added to Excel.

Given the limitations with regards to the trusted locations are there any way around this problem given that the files should be kept in the network location?

/Andy

Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
3,583 questions
0 comments No comments
{count} votes