Open VisualStudio .NET projects from network drive

VisualStudio .NET doesn't allow to open a project residing in a network drive, due to security configuration (affects all versions, 2003 and 2005). You can override this behavior through runtime's security policy configuration. You can set runtime security policy directly either using command-line statements, or the .NET Configuration management console snap-in.

Command-line - CasPol.exe

Security policy settings can be set using CasPol.exe, which resides in .NET Framework directory (depends on framework's versions):

  • %windir%\Microsoft.NET\Framework\v2.0.50727
  • %windir%\Microsoft.NET\Framework\v1.1.4322

(%windir% is a system variable holding the Windows directory of current OS installation, e.g. C:\WINDOWS, C:\WINNT, ...)

The execution of CasPol.exe is the same either working in .NET 1.x or 2.0. In all versions the parameters are the same. The following line can be run to allow opening a project, which resides in a network drive (it is assumed that you have the necessary permissions to access the coresponding network resources):


CasPol.exe -q -m -ag LocalIntranet_Zone -url "file://FILE_SERVER/SHARED_DIR/*" FullTrust -n "VS Network Access"


Executing the above will allow Visual Studio .NET to open any project under the UNC path \\FILE_SERVER\SHARED_DIR.

A short explanation of the parameters passed to CasPol.exe follows: The policy change will affect the machine level code groups. It will add a new code group  for the specified URL, to LocalIntranet_Zone, providing FullTrust permissions. No verbose messages will show up, the execution will be in quite mode.

-q         quite mode

-m        machine level options

-ag       add code group to [parent_label] with given [membership], [permission set] and [flags]

  LocalIntranet_Zone      [parent label]

  -url     [membership] url

  FullTrust          [permission set]

  -n       [flags] code group name

Note, that -url and -n options complete the -ag option (as well as LocalIntranet_Zone and FullTrust constants).