Visual Studio Unit Tests : dll is not trusted
I'm struggling getting some un开发者_开发技巧it tests running and wondering if anyone might have anything insightful.
The setup is that we've got a bunch of referenced DLL's on a server and when I try and execute I get the old
Test Run deployment issue: The location of the file or directory 'c:\source\ProjectName\bin\debug\3rdPartyLibrary.dll' is not trusted.
I've tried the old caspol command:
caspol -m -ag 1.2 -url file:\server\binaries* FullTrust
Which seems to work for everything bar one DLL. I'm currently having to manually change the permissions everytime I do a build of the test project, which is a pain. Anyone have any suggestions? Running a Win7 64bit OS btw.
Ian had the key that started the fix for me. I'm attempting to use WatiN on Windows 7 64bit and kept getting the "not trusted" error. Here are the steps I took to fix it.
- Close VS.
- Delete the WatiN directory from Programs Files (x86)
- Navigate to my user directory. Search for and delete WatiN dll's.
- Navigate to my project directory. Search for and delete all WatiN dll's.
- Re-download WatiN.
- Right click on the .zip file and unblock the contents before the copy operation.
- Recreate the WatiN directory under the Programs Files (x86) and copy the file from the .zip.
Unless you get the stray WatiN dll's VS will continue to access the untrusted DLL's and drive you nuts.
If you go to the dll through Winodws Explorer, right click and go to properties there's an "Unblock" button.
Are the .dlls in question files downloaded from the internet?
If so, they may be 'blocked' by the OS unless you explicitly unblock them. You can do this by right-clicking the files in question and select Properties, and then click on the Unblock button.
Uncheck 'readonly' before you select 'Unblock' from the properties dialog of the assembly in question. It should stay unblocked if it is not readonly.
You need to download the streams.exe from the below path: http://technet.microsoft.com/en-us/sysinternals/bb897440.aspx
place it in the same folder where you have the problem with the dll and navigate to that path in powershell/command prompt and run the below command: streams -s -d(command prompt) .\streams.exe -s -d "Folder Name"(from powershell)
精彩评论