8

Quite a simple error, and the reason is obvious - I mapped a network drive, and I am opening the solution from it. Visual Studio gives me this error.

I tried googling, and to my surprise, couldn't find a fix. I am running Visual Studio 2008.

The solutions I found on google say I should run Mscorcfg.msc, but unfortunately, I don't seem to have that file anywhere on my computer. Nor do I seem to have anything in my control panel relating to .NET Framework. I can of course, run .NET applications fine, so the framework exists.

Another solution suggested running caspol.exe, although this is .NET 2, which I also tried to no avail.

Any ideas?

I should add that I am trying to add the path to whatever trusted list there is.

Jon Seigel
  • 12,251
  • 8
  • 58
  • 92
NibblyPig
  • 51,118
  • 72
  • 200
  • 356

3 Answers3

9

caspol is the right tool to use to suppress these warnings. Here is the command I use:

C:\Windows\Microsoft.NET\Framework\v2.0.50727\caspol -m -pp off -cg 1.2 FullTrust

This will grant full trust to local intranet code group. In order for this to have the desired effect, the computer must be configured to recognize the share as being in the intranet zone.

Note that this command is for .NET 2.0, 3.0, and 3.5. (Security settings for 3.0 and 3.5 are controlled by the caspol utility for 2.0).

Stephen Schaub
  • 486
  • 1
  • 5
  • 11
  • This sorted it for me - combined with adding my UNC path to the local intranet zone in IE. – flytzen Sep 08 '10 at 11:27
  • 1
    This doesn't solve the problem for .net 4 and visual studio 2012. – Micah Aug 13 '12 at 14:17
  • For .NET 4 and VS 2012 and later you also need to run `C:\Windows\Microsoft.NET\Framework\v4.0.30319\CasPol` as noted in https://stackoverflow.com/a/6510526 – Kevinoid Sep 04 '18 at 17:06
3

If the server is in the "Internet" zone, try adding it to the "Trusted sites" in your Internet Options. (You can see the zone in the status bar in Windows Explorer.)

Fozi
  • 4,973
  • 1
  • 32
  • 56
  • I have added it to my Trusted Sites in internet options, but the message still appears. – NibblyPig Apr 08 '10 at 20:47
  • I added it to my Local intranet in Internet Options (unchecking the "Requires server verification…". The message appears, but after I uncheck the "warn for every project…" box, the project will load and the message will not appear again. Unfortunately, I also did: C:\Windows\Microsoft.NET\Framework\v4.0.30319\CasPol -m -ag 1 -url file://YourSharePath\* FullTrust so I'm not sure if BOTH the Local intranet AND the Caspol change are required. Anyway, it works now and VS doesn't hang on me! – Colin May 20 '13 at 01:12
-1

Try looking under Control Panel -> Administrative Tools for the .NET Framework Configuration utilities. From here you should be able to follow the instructions from the plethora of google results on this topic.

BenV
  • 12,052
  • 13
  • 64
  • 92
  • Unfortunately there is nothing relating to .NET Framework in the administrative tools. – NibblyPig Apr 08 '10 at 20:45
  • @SLC: Thought I'd ask the obvious question first :) On my machine this shortcut points to C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\mscorcfg.msc - do you have a similar path on your machine? – BenV Apr 08 '10 at 21:05
  • I have folders for 1.0xxx 1.1xxx (same as yours) 2.0xxx 3.0 and 3.5 , so presumably that's one for each release of the .net framework. The 1.0xxx and 1.1xxx contain just a couple of config/dll files, while 2.0xxx contains a ton of stuff but no file by that name, although there are loads of mscorxxx.dll files. 3.5 also contains a load of stuff but again, nothing by that name. – NibblyPig Apr 08 '10 at 21:16
  • Do you have the full SDK installed? Per this article MS now only included the config tool in the SDK: http://blogs.msdn.com/astebner/archive/2006/01/23/516671.aspx. This article also has a link to a standalone installer to the config tool. – BenV Apr 08 '10 at 21:53
  • 1
    I didn't, so I installed the full 2.0 sdk, which added the .net framework configuration stuff in the control panel. I followed the instructions I found via google to add the network location to my intranet sites, with full access. I also notice the entries I made with caspol.exe were there too. After adding it, I tried to open my solution, but received the same error. – NibblyPig Apr 08 '10 at 22:43
  • Did you add the network location to the LocalIntranet_Zone or Trusted_Zone? I think it needs to be in the Trusted_Zone. – BenV Apr 08 '10 at 22:58