7

I just installed Visual Studio 2010 yesterday. As part of that I installed VSTO 4.0. Now when I run any Office application, my VSTO 3.0 addins fail to load. The error in the event log is

Customization URI: file:///H:/PathToMyAddin/MyAddin.vsto Exception: Customization does not have the permissions required to create an application domain.

Microsoft.VisualStudio.Tools.Applications.Runtime.CannotCreateCustomizationDomainException: Customization does not have the permissions required to create an application domain. ---> System.Security.SecurityException: Customized functionality in this application will not work because the administrator has listed file:///H:/PathToMyAddin/MyAddin.vsto as untrusted. Contact your administrator for further assistance. at Microsoft.VisualStudio.Tools.Office.Runtime.RuntimeUtilities.VerifySolutionUri(Uri uri) at Microsoft.VisualStudio.Tools.Office.Runtime.DomainCreator.CreateCustomizationDomainInternal(String solutionLocation, String manifestName, String documentName, Boolean showUIDuringDeployment, IntPtr hostServiceProvider, IntPtr& executor) The Zone of the assembly that failed was: MyComputer

It seems like like maybe this is due to it trying to load different version of .NET is the same process/AppDomain. However the error would indicate it's some sort of permissions issue.

abatishchev
  • 98,240
  • 88
  • 296
  • 433
Jacob Adams
  • 3,944
  • 3
  • 26
  • 42

1 Answers1

8

It turns out that VSTO 4 doesn't trust add-ins on network locations by default. However, by adding the following registry key

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\vsto runtime Setup\v4]
"EnableVSTOLocalUNC"=dword:00000001

and re-enabling my add-in, it appeared to work as expected again.

Another option for some is just to install the add-in on the user's local machine instead of on a network location

Jacob Adams
  • 3,944
  • 3
  • 26
  • 42
  • what about trusting that location in Excel trusted locations (excel options)? – Anonymous Type Aug 08 '10 at 23:29
  • 2
    Not sure about Excel, but adding the location as a Word trusted location didn't help me. – Jacob Adams Aug 09 '10 at 15:40
  • I have placed the SETUP.EXE and the project.MSI outputs from my Setup Project on a Network Drive (mapped from both my dev PC and my target PC). When I run SETUP on the target PC, it seems to install without complaint but it won't respect the LoadBehavior setting (to load the addin at the startup of Outlook). I think I should try your registry fix but if that works on 1 test PC can you think of a way to avoid such a manual fix for all PCs to be deployed with my Outlook add-in? (Will report back soon on this approach). – John Adams May 10 '11 at 15:06
  • 1
    Also, if you are on a 64-bit OS, the key will be HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VSTO Runtime Setup\v4 – Steve Clanton Oct 25 '13 at 14:34