我编写了一个针对 .NET Framework 4 Client Profile 的简单 VS2010 WPF 应用程序。 (事实上,我的应用程序没有使用任何 .NET 4 功能,但 VS2010 只是默认启动我的项目以 .NET 4 为目标,所以我没有费心去检查它)
我发现所有的XP系统甚至一些各种语言的Window 7都无法启动应用程序。我决定通过更改解决方案属性中的 Target Framework
将我的应用程序反向移植到目标 .NET Framework 3.5 或 .NET Framework 3.5 Client Profile .但是该应用程序不会在 System.Xaml
和 Microsoft.CSharp
上编译或生成以下错误:
Warning 1 Could not resolve assembly System.Xaml. The target framework required by this assembly (4.0) is higher than the project target framework. If this reference is required by your code, you may get compilation errors. test1
Warning 2 The primary reference "Microsoft.CSharp", which is a framework assembly, could not be resolved in the currently targeted framework. ".NETFramework,Version=v3.5". To resolve this problem, either remove the reference "Microsoft.CSharp" or retarget your application to a framework version which contains "Microsoft.CSharp". test1
Warning 3 The referenced component 'Microsoft.CSharp' could not be found.
Warning 4 The referenced component 'System.Xaml' could not be found.
是否可以将 VS2010 应用程序返回(或返回目标)到 .NET 3.5?如果是,怎么办?
[编辑]
我发现有一个控件 - DataGrid - 设计用于 .NET 4。我必须安装 WPF 工具包才能将控件移植到 3.5。希望有人觉得这有帮助。
最佳答案
只需删除它们。测试它并为我工作。我相信这些程序集仅在 .NET 4 中引入。例如,System.Xaml 中的类型在 .NET 3.5 中的其他地方定义(例如 PresentationCore)。看这个article了解更多信息。
关于c# - 在 VS2010 中向后移植 .NET 4 到 3.5 SP1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7830375/