c# - 在 VS2010 中向后移植 .NET 4 到 3.5 SP1

标签 c# .net wpf visual-studio

我编写了一个针对 .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.XamlMicrosoft.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/

相关文章:

c# - WPF XAML : Difference between DataContext as attribute or property for XAML element?

c# - 字符串到日期格式转换

c# - 我怎样才能让我的 trie 更有效率?

c# - 使用 C# ServiceController 和模拟启动/停止 Windows 服务

wpf - 有没有办法在 wpf WebBrowser 控件之上呈现 WPF 控件?

c# - WPF GridViewRowPresenter 把所有内容变成Textblocks

c# - 有什么办法可以在 C# 中创建一个隐藏的主窗口?

c# - FindControl GridTemplateColumn 在 radGrid 事件之外

c# - 在 .Net 中创建和验证 x509 证书

c# - Windows 窗体应用程序中的左菜单选项卡控件我怎样才能得到它?它在当前控件中可用吗?