Tuesday, January 15, 2008

NMock2 was Blocked

I ran across an interesting problem today when I downloaded NMock to assist with some unit testing in Visual Studio.  Suffice to say that when I referenced the NMock assemblies, compiled and attempted to run the tests, the test manager simply aborted with the following error:

NMock Not Trusted

"Failed to Queue Test Run... [because]... the location of the file 'NMock2.dll' is not trusted."

This error seemed pretty strange to me because the assembly wasn't located on a network share but simply on my local machine. The location on disk should be trusted, right?

I located NMock2.dll on disk, opened the file properties dialogue and noticed the following at the bottom of the general tab:

Blocked NMock

So Windows Vista detected that I had downloaded the NMock DLLs from the Internet in a zip archive. When I extracted the assemblies, Windows marked the assemblies as un-trusted code.

Anyway, if you experience this issue, simply click the Unblock button and the assembly will become trusted. You may need to restart Visual Studio before the tests will run.

Technorati Tags: , , , ,

9 comments:

  1. Thanks for the help, I was stuck on that one too.

    ReplyDelete
  2. Thanks! I linked to your solution from Stack Overflow as well :)

    ReplyDelete
  3. Who the hell invented that?! How can i know about that stupid "Unlock" button? Couldn't they show more detailed error?

    ReplyDelete
  4. You have being Ping!!!

    ReplyDelete
  5. Thanks! you helped me save lots of time

    ReplyDelete
  6. Thanks. This solved one of my problems. (yes, restarting VS was necessary)

    ReplyDelete
  7. Hey! Rock'n'roll! I had the problem you described and did what you said. And now I can run my test!

    ReplyDelete
  8. Hey it worked great your little tip! Great! Now my Test is Running!

    ReplyDelete
  9. Thanks a lot for the time saving. I tried this with Moq.dll and was still getting the error. In my case I had the .pdb file, the .chm and the .xml all in the same directory. I had to perform the same operation on each file before it would run.

    ReplyDelete