Even though you may have configured the app.config file of the Test Project with the following configuration, it’ll make no difference when trying to use .NET 2.0 assemblies from a .NET 4 Test project.
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
This configuration node is not effective because Test projects are DLLs not executables. This node will not effect the actual underlying executable which hosts the Test Project’s DLL when you run tests. You need to change the config of the executable which for me is hosted under: C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow.
Look for “vstest.executionengine.x86.exe”. This is the executable which VS runs while unit testing. Now find “vstest.executionengine.x86.exe.config”
Add the above configuration node to this file, save it, run your tests and now you should find the above exception disappears.
The actual exception for me occurred while loading a Windows Azure SDK DLL:
--- End of inner exception stack trace ---
Hopefully Microsoft will fix this issue in time for RTM.