When using an old version of LeadTools I encountered an exception during the execution of a Microsoft Visual Studio 2012 test. Mixed mode assembly is built against version ‘v2.0.50727’ of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information. This error was fixed following the steps on http://blog.kristandyson.com/2012/05/encountering-systemiofileloadexception.html.

 

  1. Close Microsoft Visual Studio 2012 (and IIS express)
  2. On Windows 8, start Notepad.exe as an administrator
  3. Open the file [C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.executionengine.x86.exe.config]
  4. Add and save:

 

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <runtime>
    <legacyUnhandledExceptionPolicy enabled="1"/>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <probing privatePath="Extensions" />     
    </assemblyBinding>
  </runtime>
  <system.diagnostics>
    <switches>
      <add name="TpTraceLevel" value="0" />
    </switches>
  </system.diagnostics>
  <appSettings>
    <!–<add key="ExecutionThreadApartmentState" value ="MTA"/>–>
    <!–<add key="TraceLogMaxFileSizeInKb" value ="10240"/>–> 

    <!– MsTest Adapter Specific AppSettings –>
    <add key="TestProjectRetargetTo35Allowed" value="true" />
   </appSettings>
   <startup useLegacyV2RuntimeActivationPolicy="true">
      <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
   </startup>

</configuration>

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.