Fixed: API restriction w/ Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll
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:
- Deleting the UnitTestFramework reference from one of my test projects.
- Re-add the reference via the UI by right-clicking on the references folder
- Add reference
- .Net tab
- Select Microsoft.VisualStudio.QualityTools.UnitTestFramework
- Click ok
- Save all. At this point the processorArchitecture reference appeared in my project file.
- Compile. Failure.
- Manually edit the project file with Notepad2.
- Save.
- Reload project when VS notices the change outside of the IDE.
- Compile. Failed.
- Restart Visual Studio.
- Load solution.
- Compile solution. No errors.
Works on my machine…
