2

Since I run my stuff in a VM I like to save my data on shares on the host. But then running and debugging (web) applications and tests from within Visual Studio has problems. How can I configure everything to run with FullTrust when it's started in Visual Studio?

Or how to just configure full trust for all network drives?

I have turned off UAC.

Lars Corneliussen
  • 2,513
  • 2
  • 26
  • 36

3 Answers3

2

You'll have to use the caspol command-line command.

Open up a console-window, and type this command:

caspol -machine -addgroup <group_param> -url file://yournetworkdriveletter/* FullTrust -name somename

Note: the group_param is the group to which you want to add your new zone, which will be 'Local Intranet'. You can execute caspol -lg to see what the number of the local-intranet zone is on your system.

On my system, it is 1.2

So, the command you have to execute is:

caspol -machine -addgroup 1.2 -url file://driveletter/* FullTrust -name MyNewZoneName
Rebecca Scott
  • 2,421
  • 2
  • 25
  • 39
Frederik Gheysels
  • 56,135
  • 11
  • 101
  • 154
1

I'm not sure why, but using caspol with the -url option didn't work for me (perhaps because subdirectories are not included).

My setup is a Windows XP guest machine inside VirtualBox, with .net 2.0 executables running from shared folders. This is the command that allowed them to run:

C:\Windows\Microsoft.NET\Framework\v2.0.50727\caspol -ag 1 -allcode FullTrust



BTW, If you want to reset permissions to .NET defaults, use caspol -reset.

Yariv
  • 576
  • 5
  • 4
  • This did not work for me. VS still complains about mistrust when opening solution and code gets security exceptions. But thanks offering something different and for `caspol -reset` – Stéphane Gourichon Jul 19 '14 at 19:57
0

What version of the framework are you using?

You can use "caspol.exe" to provide extra trust for shares that you specify, but with .NET 3.5 SP1 installed, network shares get the same trust anyway: see here:

Managed applications that are opened from network shares have the same behavior as native applications by running with full trust.

I can't remember whether that applies equally to mapped shares (F:) and UNC shares (\\myserver\someshare), but it would be easy to test.

You could also consider ClickOnce, which is IMO the easiest way to deploy full .NET applications to network / web locations.

Marc Gravell
  • 1,026,079
  • 266
  • 2,566
  • 2,900