Rick Strahl's Weblog  

Wind, waves, code and everything in between...
.NET • C# • Markdown • WPF • All Things Web
Contact   •   Articles   •   Products   •   Support   •   Advertise
Sponsored by:
Markdown Monster - The Markdown Editor for Windows

Visual Studio .NET 2005 Add-ins and loading from My Documents on a remote folder


:P
On this page:

I just had an interesting message from a customer who's running my FoxPro Web Connection tool and was trying to get the Visual Studio Add-in to work. When he starts VS.NET 2005 – the Add-in fails to load and pops up a load error.


After a few questions it became clear that the problem is that his My Documents folder from which Add-ins are loaded are stored on a remote machine and mapped to an H:\ drive. The problem is that by doing this the assembly is no longer fully trusted and fails to load because it's missing some neceessary permission. The actual permission that is failing is AspNetHostingPermission, which is odd, because my code certainly isn't referencing anything in System.Web directly. In fact, System.Web isn't referenced by my add-in assembly at all. However it does reference the various VS.NET Add-in namespaces which in turn might pull in the required assemblies in order to host ASP.NET inside of VS.NET.

 

Long story short is – this seems like a pretty common scenario where somebody has a roaming profile and I don't have a good answer on how to fix it other than giving full trust to the assembly or the remote UNC, which seems a little sketchy as a recommendation.

 

Anybody have any better ideas?


The Voices of Reason


 

Mark Pearce
March 28, 2006

# re: Visual Studio .NET 2005 Add-ins and loading from My Documents on a remote folder

This should work.

First sign your assembly with a strong name key pair that you generate using the sn.exe tool. Then modify the security policy to give FullTrust to all assemblies signed with your key.

The .NET Framework Configuration control panel applet allows you to make these changes and to create an .MSI file that contains the security policy so you can easily distribute it to other people. Whenever you create new assemblies, all you'll need to do is to sign them with your key, and everyone who has the modified policy will automatically fully trust them regardless of their launch location.

# DotNetSlackers: Visual Studio .NET 2005 Add-ins and loading from My Documents on a remote folder


West Wind  © Rick Strahl, West Wind Technologies, 2005 - 2024