Home > Technology > Fixed: API restriction w/ Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll

Fixed: API restriction w/ Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll

November 11th, 2009 Leave a comment Go to comments

I wrote about this a couple days ago. I have now confirmed my fix.

ENV:
Win7 Ent x64, VS 2008 SP1

Problem:
API restriction: The assembly ‘file:///c:\Program Files (x86)\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.

Solution:
Make sure you don’t have any extra references in your non-test projects. It happened to one guy on our team. The reference showed up during the check-in code review.

Remove “processorArchitecture=MSIL” from the UnitTestFramework reference in ALL of the test project files.

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

becomes…

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

Restart VS. Reloading the project isn’t enough to get around the issue once it has popped up. I had to restart Visual Studio.

The issue went away after I double checked all of my project files and cleaned up the references in my test projects. (There are 12 projects in my current solution including 5 test projects.) I tested the fix by:

  1. Deleting the UnitTestFramework reference from one of my test projects.
  2. Re-add the reference via the UI by right-clicking on the references folder
  3. Add reference
  4. .Net tab
  5. Select Microsoft.VisualStudio.QualityTools.UnitTestFramework
  6. Click ok
  7. Save all. At this point the processorArchitecture reference appeared in my project file.
  8. Compile. Failure.
  9. Manually edit the project file with Notepad2.
  10. Save.
  11. Reload project when VS notices the change outside of the IDE.
  12. Compile. Failed.
  13. Restart Visual Studio.
  14. Load solution.
  15. Compile solution. No errors.

Works on my machine…

  1. No comments yet.
  1. No trackbacks yet.
You must be logged in to post a comment.