Visual Studio .NET 2005 Add-ins and loading from My Documents on a remote folder
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?
Other Posts you might also like
- Map Physical Paths with an HttpContext.MapPath() Extension Method in ASP.NET
- Adding minimal OWIN Identity Authentication to an Existing ASP.NET MVC Application
- Getting the Client IP Address in ASP.NET Core
- Adding Default Assemblies, Namespaces and Control Prefixes in Web.Config
- Preventing iOS Textbox Auto Zooming and ViewPort Sizing
# re: Visual Studio .NET 2005 Add-ins and loading from My Documents on a remote folder
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.