Sep 22, 2009

VS MSTEST Test Run Deployment Item Error – DLL not trusted

I remember having this error for a couple of times already during the last few years – so I write a post of my own about the solution to the following issue:

Running Visual Studio 2008 (MSTEST) unit tests fails with:

Failed to queue test run '2009-09-22 17:11:11': Test Run deployment issue: The location of the file or directory 'sqlite3.dll' is not trusted.

image

There were some hints about using the caspol tool to add full trust to the assembly which DID NOT WORK FOR ME:

C:\Program Files\Microsoft Visual Studio 9.0\VC>caspol -m -ag 1.2 -url \\localhost\c$\project\tools\* FullTrust

Microsoft (R) .NET Framework CasPol 2.0.50727.4016
Copyright (c) Microsoft Corporation.  All rights reserved.

The operation you are performing will alter security policy.
Are you sure you want to perform this operation? (yes/no)
yes
Added union code group with "-url" membership condition to the Machine level.
Success

A better approach was:

1. Remove the reference to the dll from VS
2. Shut down VS
3. Right click the assembly (here the sqlite3.dll) und click the UNBLOCK button.
4. Restart Visual Studio
5. Re-add the reference to the file

image

(thanks to markrob35)

No comments:

Post a Comment