Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mixed Mode Assembly with Xunit Test runner extension for Visual Studio 2012

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.

like image 411
Alex Spence Avatar asked Dec 21 '22 17:12

Alex Spence


1 Answers

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)

like image 67
Doug Avatar answered Dec 28 '22 08:12

Doug