The Project Location is Not Trusted Dialog Box when trying to use Network Location
The Project Location is Not Trusted Dialog Box
This dialog box appears each time I attempt to create a client project to a folder on my NAS “\\N5200\Development\”. If I ignore the warning, the project will not run correctly when I attempt to debug or run from this location.
I am aware that by default, a UNC path is not a trusted location for a project. I have tried each of the following without success:
Mscorcfg.msc
One simple way to modify the policy affecting a file share is to give a specific file share FullTrust permission using Mscorcfg.msc. You must be an administrator on the computer to make this change.
To give a file share FullTrust permission
- Start Mscorcfg.msc.
- Expand the Runtime Security Policy node, the Machine node, the Code Groups node, and the All_Code node, and then highlight the LocalIntranet_Zone node.
- In the right pane, click Add a Child Code Group.
- Choose Create a new code group, enter a name for the code group, and then click Next.
- Choose a condition type of URL, and enter the UNC path to the share location of your project, using the format file://\\N5200\Development\* Click Next.
- Choose Use existing permission set and select FullTrust, and then click Next.
- Click Finish.
- Restart Visual Studio.
Caspol.exe
Using caspol.exe to accomplish this change, you would use the following command line (you must be an administrator on the computer to make this change.):
C:\Windows\Microsoft.NET\Framework64\v2.0.50727\caspol -m -ag 1.2 -url \\N5200\Development\* FullTrust
What should I do to resolve this issue? Saving to local machine is not an option. {Using Vista Ultimate and VS 2005, running all as administrator.} Thanks.
Answers
Two part process:
STEP #1
Mscorcfg.msc
One simple way to modify the policy affecting a file share is to give a specific file share FullTrust permission using Mscorcfg.msc. You must be an administrator on the computer to make this change.
To give a file share FullTrust permission
- Start Mscorcfg.msc. or from the Start Menu, Admin Tools, Microsoft .NET Framework 2.0 Configuration
- Expand the Runtime Security Policy node, the Machine node, the Code Groups node, and the All_Code node.
- In the right pane, click Add a Child Code Group.
- Choose Create a new code group, enter a name (VS Developmenmt)for the code group, and then click Next.
- Choose a condition type of URL, and enter the UNC path to the share location of your project, using the format \\servername\sharename\* where \\servername\sharename (\\N5200\*) is the name of the share. Click Next.
- Choose Use existing permission set and select FullTrust, and then click Next.
- Click Finish.
- Select your new code group, right click, and select Properties
- Under the General tab, check the two boxes under the "If the membership condition is met" statement, then click Apply
- Close Mscorcfg, Reboot Machine
- Restart Visual Studio - You will now be able to create a new project without The Project Location is not Trusted Dialog Box. However, you will not be able to Debug until you choose a zone for your partial-trust application
Step #2
choose a zone for your partial-trust application
<!--[endif]-->- From the Project menu, choose Projectname Properties.
- In the Projectname property pages, click the Security page.
- Select Enable ClickOnce Security Settings.
- Under Zone your application will be installed from, click the drop-down listbox and choose the zone you want to simulate the application being installed from.
The Permissions required by the application grid shows all available permissions. The check mark indicates permissions granted to your application
- If the zone you choose was (Custom), select the correct custom settings in the Setting column of the Permissions grid.
- Click OK to close the property pages.
All Replies
Two part process:
STEP #1
Mscorcfg.msc
One simple way to modify the policy affecting a file share is to give a specific file share FullTrust permission using Mscorcfg.msc. You must be an administrator on the computer to make this change.
To give a file share FullTrust permission
- Start Mscorcfg.msc. or from the Start Menu, Admin Tools, Microsoft .NET Framework 2.0 Configuration
- Expand the Runtime Security Policy node, the Machine node, the Code Groups node, and the All_Code node.
- In the right pane, click Add a Child Code Group.
- Choose Create a new code group, enter a name (VS Developmenmt)for the code group, and then click Next.
- Choose a condition type of URL, and enter the UNC path to the share location of your project, using the format \\servername\sharename\* where \\servername\sharename (\\N5200\*) is the name of the share. Click Next.
- Choose Use existing permission set and select FullTrust, and then click Next.
- Click Finish.
- Select your new code group, right click, and select Properties
- Under the General tab, check the two boxes under the "If the membership condition is met" statement, then click Apply
- Close Mscorcfg, Reboot Machine
- Restart Visual Studio - You will now be able to create a new project without The Project Location is not Trusted Dialog Box. However, you will not be able to Debug until you choose a zone for your partial-trust application
Step #2
choose a zone for your partial-trust application
<!--[endif]-->- From the Project menu, choose Projectname Properties.
- In the Projectname property pages, click the Security page.
- Select Enable ClickOnce Security Settings.
- Under Zone your application will be installed from, click the drop-down listbox and choose the zone you want to simulate the application being installed from.
The Permissions required by the application grid shows all available permissions. The check mark indicates permissions granted to your application
- If the zone you choose was (Custom), select the correct custom settings in the Setting column of the Permissions grid.
- Click OK to close the property pages.
- Worked Great! Thanks Phill...
I'm having the same problem but these steps didn't work.
The dialog still appeas every time I open the project and security exceptions are thrown whenever I try to accesss the serial port. Visual Studio's Project directory are on a network drive, "H:", so I set the URL condition to "file://H:/Visual Studio 2008/Projects/*". I set the Project Properties as described above and rebooted but it still says that the project location is not trusted.
My Control Panel lead me to
"Microsoft .NET Framework 1.1 Configuration"
is that "1.1" the version of the configuration program or the .NET version? If it's the .NET version then something is wrong because I've installed .NET 3.5.
What am I doing wrong?
thank you so much!
- The procedure above assumes that the network share is located in the Intranet Zone. For some reason, Windows thought my Buffalo Linkstation (NAS) was located in the Internet Zone instead of IntraNet so all the forum postings that talked about changing the security policies didn't work because the location was in the wrong zone!
So first check what zone your shared folder is located in by navigating there in Windows Explorer and checking the zone icon in the status bar (if the status bar is not visible, select View->Status Bar from the menu).
As far as I know, the .net framework uses the same zone settings as Internet Explorer so one way to change the zone of the network folder (if the folder is in the wrong zone), is to open Internet Explorer and go to Tools->Internet Options->Security and click on Local IntraNet. Then click the Sites button then the Advanced button. Finally, in the textbox labelled "Add this website to the zone:" enter the UNC path for the shared folder and click add. For my case, this was file://Buffalo
Having done that, the Local Intranet icon should now appear when the network share is navigated to in Windows Explorerer and the procedure above using mscorcfg should now work. Be sure to restart Visual Studio after making the security changes.- Proposed As Answer byWiyosaya1 Thursday, July 02, 2009 1:21 PM
The procedure above assumes that the network share is located in the Intranet Zone. For some reason, Windows thought my Buffalo Linkstation (NAS) was located in the Internet Zone instead of IntraNet so all the forum postings that talked about changing the security policies didn't work because the location was in the wrong zone!
This is another solution that works as well.
So first check what zone your shared folder is located in by navigating there in Windows Explorer and checking the zone icon in the status bar (if the status bar is not visible, select View->Status Bar from the menu).
As far as I know, the .net framework uses the same zone settings as Internet Explorer so one way to change the zone of the network folder (if the folder is in the wrong zone), is to open Internet Explorer and go to Tools->Internet Options->Security and click on Local IntraNet. Then click the Sites button then the Advanced button. Finally, in the textbox labelled "Add this website to the zone:" enter the UNC path for the shared folder and click add. For my case, this was file://Buffalo
Having done that, the Local Intranet icon should now appear when the network share is navigated to in Windows Explorerer and the procedure above using mscorcfg should now work. Be sure to restart Visual Studio after making the security changes.
I initially had no luck when adding the UNC path to the LocalIntranet_Zone. I then found a post somewhere that suggested modifying the permissions on the Internet_Zone. I modified permissions for the Internet_Zone, and the solution loaded and ran without problems.
However, on searching to post my experience to these forums, I found this post. I added the UNC path to the PC (just the PC that is "\\PC_Name", not the actual share on the PC) with the share to the Local IntraNet as described above, deleted the code group from the Internet_Zone in the security settings (leaving a similar entry in the LocalIntranet_Zone code group), and the troublesome projects now load without problems and run perfectly.


