Monacraft
Monacraft

Reputation: 6630

System.IO.FileLoadException with XNA

I'm using Xna 3.0 (With C# 4.0) and upon compiling the blank template in SharpDevelopPortable I get this error:

System.IO.FileLoadException: 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.
   at Test_XNA.Game1..ctor()
   at Test_XNA.Program.Main() in c:\Users\%username%\Documents\Stuff\SharpDevelopPortable\Data\SharpDevelop Projects\Test_XNA\Test_XNA\Program.cs:line 9

This highlighted:

using System;

namespace Test_XNA
{
    static class Program
    {
        static void Main()
        {
            Game1 game = new Game1();  // <-- This line is highlighted 
            game.Run();
        }
    }
}

It is important to note that my Xna version and C# version are different. Also I am not an administrator, which is why I am using Xna 3.0. I've also been getting this warning:

Found conflicts between different versions of the same dependent assembly. (MSB3247)

Though I'm not sure what this means.

Any suggestions would be appreciated.

Upvotes: 0

Views: 100

Answers (1)

nvoigt
nvoigt

Reputation: 77285

According to this excellent answer, you will have to find your app.config file and add the useLegacyV2RuntimeActivationPolicy="true" attribute to your startup tag:

<?xml version="1.0"?>
<configuration>
  <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
  </startup>
</configuration>

Upvotes: 1

Related Questions