0

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.

Monacraft
  • 6,510
  • 2
  • 17
  • 29
  • Did you put the exception message into google? Just asking because I had the same problem this morning and the first hit was an SO site with a solution. – nvoigt Aug 25 '14 at 11:37
  • I looked at that, but am not sure if it is relevent, how did you fix your problem @nvoigt – Monacraft Aug 25 '14 at 11:40
  • I did exactly what the top-rated, accepted answer in my first hit in google told me to do. You did google your problem and you did click on the first link there, right? Is there anything unclear about that answer? – nvoigt Aug 25 '14 at 11:42
  • There were multiple SO questions on this topic, I read through them - but wasnt sure: could you please link me the one you used. Most of the ones I looked at the user found a problem on their behalf. – Monacraft Aug 25 '14 at 11:44
  • possible duplicate of [What 'additional configuration' is necessary to reference a .NET 2.0 mixed mode assembly in a .NET 4.0 project?](http://stackoverflow.com/questions/2455654/what-additional-configuration-is-necessary-to-reference-a-net-2-0-mixed-mode) – nvoigt Aug 25 '14 at 11:44
  • That worked perfectly, post it as an answer so I can mark it right. – Monacraft Aug 25 '14 at 11:47
  • I just want to say I love you, now I can do XNA!!!!!! – Monacraft Aug 25 '14 at 11:48

1 Answers1

1

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>
Community
  • 1
  • 1
nvoigt
  • 75,013
  • 26
  • 93
  • 142