Thursday, February 19, 2009

Visual Studio 2008 x64: The Project Location is Not Trusted

Aargh... here's hoping I can save someone else some time on this. I raised a new Windows Server 2008 x64 .NET build machine and loaded up Visual Studio 2008 on there. I then tried to open up a project stored on a network share via a UNC path (\\server\share\my.sln) and got the dreaded "project location is not trusted" dialog.

I started looking for the .NET Framework 2.0 Configuration utility in the Administrative Tools area so I could grant FullTrust to my share. It isn't there. Apparently it used to deploy as part of the .NET Framework 2.0 SDK, but the .NET 3.5 (Windows 2008) SDK no longer includes it. This is a shame because the alternative, CasPol.exe, is harder to work with.

At any rate, I fired up a Windows Server 2008 command shell and ran the following command to trust my network share (for those not familiar with CasPol and its syntax, here is an excellent post):
caspol.exe -m -ag 1.2 -url file://\\server/share/* FullTrust
However, upon opening my project, I was continuing to get prompted that the location was not trusted. Finally I noticed that the Windows Server 2008 command shell was an x64 command shell... and Visual Studio 2008 is a 32-bit (x86) application. You have to set the security policy separately for the appropriate version of the .NET Framework.

I then navigated to the x86 version of caspol (%windir%\Microsoft.NET\Framework\v2.0.50727\caspol.exe), issued the same command... and voila, no more prompting!



6 comments:

  1. This post made my day! Thank you, thank you!

    I'm running VS08 on Win7 x64, and had originally used the MMC snap-in to add the trust for my share. VS continued to prompt me that the location was not trusted.

    Thanks to your post I figured out that I needed to remove the entry created by the snap-in and re-add the share trust using caspol from the 32-bit command shell.

    Thanks again!

    ReplyDelete
  2. Thanks - this helped! The MSDN documentation was worthless - thanks for the detailed example.

    Emmanuel
    twitter.com/ehuna

    ReplyDelete
  3. Big help in Windows 7. Thanks a LOT!

    ReplyDelete
  4. Running win 7 64 bit and for projects on my nas drive i needed -ag 1.3 -url file://\\server/share/* FullTrust
    It taken me nearly an hour to get this sorted...thanks Microsoft

    ReplyDelete
  5. A) Thanks! That worked, I am running on Win 7 x64, VS 2008.
    B) Yet another Microsoft stupidity, jumping back to an esoteric tool that is totally non-intuitive.

    You have my many thanks.

    ReplyDelete