4
votes

I am unable to get the Xunit test runner extension for Visual Studio 2012 RTM to load my x64 Mixed Mode Assembly.

The error is: System.IO.FileLoadException: Mixed mode assembly is build against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information.

A similar question is here: Visual Studio 2012 Test Project Mixed Mode Runtime

I have added the following line to all .config files in this folder: C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow

<startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
</startup>

I even added it to this folder: C:\Users\Alex\AppData\Local\Microsoft\VisualStudio\11.0\Extensions\zuclypws.1z3 that contains xunit.runner.visualstudio.dll.. I named it xunit.runner.visualstudio.dll.config

Does anyone know how to get this working? I wish this wasn't so unnecessarily complicated.

1

1 Answers

11
votes

You need to also add the .net 2.0 assemblies to the list.

<configuration>
  <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0"/>
    <supportedRuntime version="v2.0.50727"/>
  </startup>
</configuration>

I wrote a post about this very problem in VS 2012:

http://www.diaryofaninja.com/blog/2012/09/13/net-20-mixed-mode-assemblies-in-visual-studio-net-45-test-projects

In Visual Studio 2012, you need to add the startup code to the following file:

C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.executionengine86.exe.config

You may also need to add this to the app.config inside the xunit test runner's application folder (ie inside program files)