Been seeing this issue come up on our internal aliases: The test engine cannot run tests in the assembly 'Tests.dll' because the assembly is not fully trusted by .NET Framework Security Policy

When trying to run web / load tests from the command line using mstest.exe using mstest /testcontainer:tests.dll gives the following error:

Microsoft (R) Test Execution Command Line Tool Version 9.0.21022.8

Copyright (c) Microsoft Corporation. All rights reserved.

Loading Tests.dll...

Tests.dll

UTA058: The test engine cannot run tests in the assembly 'Tests.dll' because the assembly is not fully trusted by .NET Framework Security Policy. Please run the tests from a local directory, or use the .NET Framework Configuration tool to grant this assembly the Full Trust permission, and then try again.

 

To resolve this issue:

1. In the .NET Framework 2.0 Configuration, Go to Runtime Security Policy | Machine | All_Code

2. Right click All_Code, select "New...", and select any name for your new group. Click Next

3. Select URL as your condition
4. Type \\machine_name\shared_folder\assembly.dll or \\machine_name\shared_folder\* and click Next

5. Make sure permission is set to FullTrust
6. Click Next, and Finish
7. Close all your VS IDEs, restart, and try again

8. if that does'nt fix try the command line:

caspol -machine -addgroup 1 -url file://w:/* FullTrust -name FileW