MSTest run fails because source assembly is not trusted

mstest

I just added xUnit to our test project (for the Asserts, we're still using MSTest as the framework) and immediately the test runs refused to execute any of the tests. This is the error message:

Failed to queue test run '{ …. }'
Test run deployment issue: The
location of the file or directory
'…xUnit.dll' is not trusted.

Best Answer

It took me a few tries to find the answer in Google, so I'm putting it here in case anyone else runs into the same problem. A detailed description can be found at this blog posting.

Basically, the fix invovles right-clicking on the dll file (xunit.dll for example) in Windows Explorer, going to Properties, and clicking "Unblock" at the bottom of the tab next to the 'Security' text. It seems that Vista / Windows 2008 will automatically mark assemblies that come from other machines or the internet as unsafe.

As a couple commenters have mentioned, you may also need to restart Visual Studio for this to take effect.

Related Topic