0

我正在使用 Xna 3.0(使用 C# 4.0)并在 SharpDevelopPortable 中编译空白模板时出现此错误:

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

这突出了:

using System;

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

需要注意的是,我的 Xna 版本和 C# 版本是不同的。另外我不是管理员,这就是我使用 Xna 3.0 的原因。我也收到了这个警告:

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

虽然我不确定这意味着什么。

任何建议,将不胜感激。

4

1 回答 1

1

根据这个出色的答案,您必须找到您的app.config文件并将useLegacyV2RuntimeActivationPolicy="true"属性添加到您的startup标签中:

<?xml version="1.0"?>
<configuration>
  <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
  </startup>
</configuration>
于 2014-08-25T11:50:16.767 回答