Test Run deployment issue: directory is not trusted.  
Author Message
Kai123





PostPosted: Visual Studio Team System - Testing, Test Run deployment issue: directory is not trusted. Top

Hi all,

I have an application which uses a DLL from our network drive M:\VS2005. Build works fine, but when I call the Testproject it always aborts with this error message:

Failed to Queue Test Run ... with id ...: Microsoft.VisualStudio.TestTools.TestManagement.ExecutionException: Test Run deployment issue: The location of the file or directory 'M:\VS2005\MyDLL.dll' is not trusted.

Here i've read about caspol.exe and I tried it with every combination like M:\VS2005\* or //server/share/vs2005/* or else, all without success :-( I even set off security with caspol -security off and it still does not work :-(

Copying the dll to local file and using it from there works of course. "CopyLocal" is also set to true to after building the file is available locally in bin directory. Any ideas Many thanks in advance!


Visual Studio Team System1  
 
 
David Gorena Elizondo - MSFT





PostPosted: Visual Studio Team System - Testing, Test Run deployment issue: directory is not trusted. Top

Hello,

Yes you have to add the directories as trusted URLs to the .NET Framework 2.0 Configuration. You can use caspol, be sure to use it similarly to this:

caspol -m -ag 1.2 -url \\server\path\* FullTrust

Thanks,
David Gorena Elizondo
[MSFT] VSTS


 
 
Kai123





PostPosted: Visual Studio Team System - Testing, Test Run deployment issue: directory is not trusted. Top

Hi David,

sorry for late response as I was ill the last days.

I've tried with caspol again. Return message is "Added union code group with '-url' membership condition to the Machine level. Success", but nevertheless it still does not work . Any further ideas Thanks!


 
 
David Gorena Elizondo - MSFT





PostPosted: Visual Studio Team System - Testing, Test Run deployment issue: directory is not trusted. Top

Hello,

First of all, make sure that after running caspol, you restart the IDE... this might be the problem.

Now, if the above doesn't work, another possible cause is that your referenced assembly has a security attribute set (this happens when you download an assembly from the Internet, for example), so you have to view the properties of the file and click the unblock button in the General tab.

Thanks,
David Gorena Elizondo
[MSFT] VSTS


 
 
Kai123





PostPosted: Visual Studio Team System - Testing, Test Run deployment issue: directory is not trusted. Top

Hi David,

now it's working!! Thanks a lot for your support!

I've now notice a little difference between the blog and your posting: The blog says it's "... -url file:..." Using it with the word 'file' does work now, many thanks!



 
 
Tatworth





PostPosted: Visual Studio Team System - Testing, Test Run deployment issue: directory is not trusted. Top

Thank you David,
I used a script like


REM The following directory is for .NET 2.0
REM from http://www.codeproject.com/cs/system/WindowsService.asp
set DOTNETFX2=%SystemRoot%\Microsoft.NET\Framework\v2.0.50727
set PATH=%PATH%;%DOTNETFX2%
caspol -m -ag 1.2 -url "\\Server\Path Here\*" FullTrust
PAUSE


where Server\Path Here needs to be changed to actual location of the directory containing the DLL's.

Caspol will prompt with a "do you really want to do this" type of message, answer "y" and the permissions will get set. My unit tests are now working with the exception that code coverage statistics are not available for the netoworked DLL's.



 
 
ShawnW277871





PostPosted: Visual Studio Team System - Testing, Test Run deployment issue: directory is not trusted. Top

Hello David E.,

Upon opening a solution in VS 2005 SP1, I also get a warning message that says, "The project location is not trusted: ...." This project location is on a shared network drive of a server that is running a fully patched version of Windows Server 2003.

The location-not-trusted warning appears on my PC, which is running Vista with the beta SP1 for VS 2005 SP1. There are only two user accounts on my Vista PC, and both accounts are part of the Administrators group. My PC and the server containing my project location are both in the same Domain.

When I run my project on my Vista PC, I get an error-message window that pops up regarding "SecurityException was unhandled." However, on my other PC with XP SP2 and VS 2005 SP1, my project runs without error when my project in stored at the same network-drive location.

I tried to follow your advice above, so I issued the following command, which gives an Access Denied error when I type "Y" or "yes" to save the changes to my security settings:

C:\Windows\Microsoft.NET\Framework\v2.0.50727\caspol -m -ag 1.2 -url \\Southfield7\N\* FullTrust

Actually, the full error message is as follows:

ERROR: Runtime error: Access denied. You might not have administrative credentials to perform this task. Contact your system administrator for assistance.

However, on my PC with XP SP2 and VS 2005 SP1, the caspol command above works fine.

My system administrator does not know why I am receiving the Access Denied error. It is my company's policy to store and run all projects that I develop on network drives instead of my local drives. However, this project does work fine on my Vista PC when it is stored on C:.

Do you have any suggestions about how I can get past the Access Denied error on my Vista PC

Sincerely,

Shawn W.


 
 
David Gorena Elizondo - MSFT





PostPosted: Visual Studio Team System - Testing, Test Run deployment issue: directory is not trusted. Top

Hi Shawn

I don't currently have a machine to repro your scenario... but as a first thing, let me ask you the following...

When you ran the caspol command, did you ran it on a command prompt that was "run as Administrator" You need credentials on the cmd.exe application to be able to do this.

Let me know if this was the problem.

Thanks,
David Gorena Elizondo
[MSFT] VSTS


 
 
ShawnW277871





PostPosted: Visual Studio Team System - Testing, Test Run deployment issue: directory is not trusted. Top

Dear David E.,

Thank you very much for the providing correct advice.

The Caspol command ran without error once I started cmd.exe by right clicking and then selecting Run as administrator.

More importantly, after running the Caspol command, my project ran without any errors (including without the "SecurityException was unhandled" error) in VS 2005 SP1 on my Vista PC.

Sincerely,

Shawn W.