views:

505

answers:

3

I'm struggling getting some unit 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.

+1  A: 

If you go to the dll through Winodws Explorer, right click and go to properties there's an "Unblock" button.

Simon G
There is, this is how I unlock the file to run a test. But it's not practical doing this after every build. It also doesn't make any difference if I do this to the DLL on the server.
Ian
Just found these instructions for removing the "Unblcok" option: http://www.petri.co.il/unblock-files-windows-vista.htm (method 3) options are there in Windows 7 too.
Simon G
Unfortunately it appeared to work, until I restarted my machine at which point it worked no longer, though the settings have persisted.
Ian
A: 

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.

Mark Seemann
Mark, this DLL comes from within a Zip file, downloaded from the internet I believe.As I mentioned in the other answer, unblocking only works on the local file that gets copied, and has to be done on a per-build basis.
Ian
Did you Unblock the zip file before you unzipped it? Although I can't really explain it, I've had the same problem and it didn't go away until I unblocked the zip file. If you try this out, remember that you must restart VS before it picks up the file changes, but I guess that on a build server, it always starts from a clean slate.
Mark Seemann
Mark, no I didn't will give that a try.
Ian
Unfortunately don't have the zip anymore. Feel like downloading it to trust it to unzip it is not the right approach...
Ian
+1  A: 

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.

  1. Close VS.
  2. Delete the WatiN directory from Programs Files (x86)
  3. Navigate to my user directory. Search for and delete WatiN dll's.
  4. Navigate to my project directory. Search for and delete all WatiN dll's.
  5. Re-download WatiN.
  6. Right click on the .zip file and unblock the contents before the copy operation.
  7. 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.

Victor Carless
Thanks Victor. Will try this out at some point...
Ian