locked
System.IO.FileLoadException: Mixed mode assembly is built against version 'v2.0.50727' RRS feed

  • Question

  • Hello, I'm running into this Mixed Mode assembly error using VS2010 and .NET 4. My program was working fine until i tried to add a reference to Microsoft.Xna.Framework which i recently downloaded from the microsoft website here: http://www.microsoft.com/download/en/details.aspx?id=20914

    I am trying to integrate an Xbox 360 controller into my program and need the XNA framework to do so. The exact error is as follows:

    An unhandled exception of type 'System.IO.FileLoadException' occurred in System.Windows.Forms.dll
    Additional information: 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.

    I've done some digging and always find posts about web applications that involve changing the config file slightly to include this code.

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
      <startup useLegacyV2RuntimeActivationPolicy="true">
        <supportedRuntime version="v4.0"/>
        <requiredRuntime version="v4.0.20506" />
      </startup>
    </configuration>

    My application is a windows form and not a web app, but i tried the above solution regardless and still get the error. 

    It must be a problem with the Microsoft.Xna.dll file i am referencing, but i do not know how to go about solving the problem. ANY help or debugging advice is greatly appreciated. 

    Regards,

    Monday, March 26, 2012 5:34 PM

Answers