gpt4 book ai didi

.net - 如何使 Visual Studio 2010 在 Windows Phone 项目上使用 .NET 4.0 而不是 .NET 2.0?

转载 作者:行者123 更新时间:2023-12-01 13:00:08 24 4
gpt4 key购买 nike

这是一个 Windows Phone 7 项目。

出于某种奇怪的原因,Visual Studio 2010 不允许我在项目设置的“应用程序”选项卡中将目标 .NET 版本设置为 .NET 4.0。它是灰色的。

当我编译项目时,XNA 程序集是 .NET 4.0,但 System 和 System.Core 以及所有其他程序集都是 .NET 2.0。

当我说“添加引用”时,它不会让我选择任何 .NET 4.0 系统程序集,例如 mscorlib。

我卸载了 .NET 4.0,然后重新安装了它。没有帮助。

编辑:我的最终目标是编译它。为什么选择 .NET 2.0 作为系统程序集?

编辑:我遇到了这些错误:

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360,9): warning MSB3268: The primary reference "Microsoft.Xna.Framework.Video" could not be resolved because it has an indirect dependency on the framework assembly "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v4.0,Profile=Client". To resolve this problem, either remove the reference "Microsoft.Xna.Framework.Video" or retarget your application to a framework version which contains "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089".
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360,9): warning MSB3268: The primary reference "Microsoft.Xna.Framework.Net" could not be resolved because it has an indirect dependency on the framework assembly "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v4.0,Profile=Client". To resolve this problem, either remove the reference "Microsoft.Xna.Framework.Net" or retarget your application to a framework version which contains "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089".
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360,9): warning MSB3268: The primary reference "Microsoft.Xna.Framework.Avatar" could not be resolved because it has an indirect dependency on the framework assembly "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v4.0,Profile=Client". To resolve this problem, either remove the reference "Microsoft.Xna.Framework.Avatar" or retarget your application to a framework version which contains "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089".
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360,9): warning MSB3268: The primary reference "Microsoft.Xna.Framework.Storage" could not be resolved because it has an indirect dependency on the framework assembly "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v4.0,Profile=Client". To resolve this problem, either remove the reference "Microsoft.Xna.Framework.Storage" or retarget your application to a framework version which contains "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089".
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360,9): warning MSB3268: The primary reference "Microsoft.Xna.Framework.Xact" could not be resolved because it has an indirect dependency on the framework assembly "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v4.0,Profile=Client". To resolve this problem, either remove the reference "Microsoft.Xna.Framework.Xact" or retarget your application to a framework version which contains "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089".
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360,9): warning MSB3268: The primary reference "Microsoft.Xna.Framework.Net" could not be resolved because it has an indirect dependency on the framework assembly "System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v4.0,Profile=Client". To resolve this problem, either remove the reference "Microsoft.Xna.Framework.Net" or retarget your application to a framework version which contains "System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089".
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360,9): warning MSB3268: The primary reference "Microsoft.Xna.Framework.Xact" could not be resolved because it has an indirect dependency on the framework assembly "System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v4.0,Profile=Client". To resolve this problem, either remove the reference "Microsoft.Xna.Framework.Xact" or retarget your application to a framework version which contains "System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089".
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360,9): warning MSB3268: The primary reference "Microsoft.Xna.Framework.Xact" could not be resolved because it has an indirect dependency on the framework assembly "System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v4.0,Profile=Client". To resolve this problem, either remove the reference "Microsoft.Xna.Framework.Xact" or retarget your application to a framework version which contains "System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089".
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360,9): warning MSB3268: The primary reference "Microsoft.Xna.Framework.Xact" could not be resolved because it has an indirect dependency on the framework assembly "Microsoft.VisualC, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v4.0,Profile=Client". To resolve this problem, either remove the reference "Microsoft.Xna.Framework.Xact" or retarget your application to a framework version which contains "Microsoft.VisualC, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".

编辑: 好的,我删除了那些有问题的 XNA 程序集。事实证明我不需要它们。现在编译器又回到了这个错误:

error CS0518: Predefined type 'System.Object' is not defined or imported

Compile complete -- 1 errors, 0 warnings

最佳答案

Visual Studio 正在向您显示正确的程序集。您不能为 Windows Phone 7 选择 .NET 4.0 程序集,原因很简单,Windows Phone 7 不运行 .NET 4.0。

你看到的版本应该是这样的:

  • Microsoft.Phone.* - 7.0.0.0
  • Microsoft.XNA.* - 4.0.0.0
  • mscorelib - 2.0.5.0
  • 系统。* - 2.0.5.0

关于.net - 如何使 Visual Studio 2010 在 Windows Phone 项目上使用 .NET 4.0 而不是 .NET 2.0?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6784729/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com