Question

The following error pops up every now and then:

C:\Program Files\MSBuild\Microsoft\VisualStudio\v9.0\TeamTest\Microsoft.TeamTest.targets(14,5): error : API restriction: The assembly 'file:///C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll' has already loaded from a different location. It cannot be loaded from a new location within the same appdomain.

How do I get rid of it?

Was it helpful?

Solution

  • Edit the .csproj file
  • Remove the processorArchitecture=MSIL on the end of the UnitTestFramework reference.

Change:

<reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />

to:

<reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
  • Restart Visual Studio

OTHER TIPS

If you are getting this error when it tries to run the tests on your TFS Build Server, then you may just have to change the pattern that the TFS build definition uses to locate test assemblies. This post describes the problem and solution. Basically TFS is finding the same test assembly in two different folders and tries to include it twice. To fix this:

  1. Open Team Explorer
  2. Expand tree until you see builds for your project
  3. Select the build in question
  4. Right Click > Edit Build Definition
  5. Click Process on side bar on left
  6. Expand '2. Basic' > Automated tests
  7. Click Edit
  8. Change the Test assembly file specification to remove matching a folder in the pattern. E.g. change ****\test.dll** to *test*.dll

By removing the folder from the match pattern (i.e. the \) it will only include the test assembly once, even if it finds it in two different folders.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top