简体   繁体   English

VS2010中的后端口.NET 4到3.5 SP1

[英]Back port .NET 4 to 3.5 SP1 in VS2010

I wrote a simple VS2010 WPF application which targeted .NET Framework 4 Client Profile . 我写了一个简单的VS2010 WPF应用程序,它针对.NET Framework 4 Client Profile (In fact, my app does not use any .NET 4 features, but VS2010 just by default started my project targeting .NET 4 so I didn't bother to check it) (事实上​​,我的应用程序不使用任何.NET 4功能,但VS2010默认启动我的项目定位.NET 4,所以我没有费心去检查它)

I found all XP system and even a few Window 7 of various languages failed to start the app. 我发现所有XP系统甚至一些各种语言的Window 7都无法启动应用程序。 I decided to back port my app to target .NET Framework 3.5 or .NET Framework 3.5 Client Profile , by changing the Target Framework in solution's properties. 我决定通过更改解决方案属性中的Target Framework ,将我的应用程序移植到目标.NET Framework 3.5.NET Framework 3.5 Client Profile But the app does not compile or build with the following error on System.Xaml and Microsoft.CSharp : 但是,在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.  

Is it possible to back port (or back target) a VS2010 app to .NET 3.5? 是否可以将VS2010应用程序的端口(或后端目标)备份到.NET 3.5? If so, how? 如果是这样,怎么样?

[EDIT] [编辑]

I found there was one Control - DataGrid - that is designed to use for .NET 4. I have to install WPF Tool Kit to back port the controls to 3.5. 我发现有一个Control - DataGrid - 设计用于.NET 4.我必须安装WPF工具包以将控件移回到3.5。 Hope someone find this helpful. 希望有人觉得这很有帮助。

Just remove them. 只需删除它们。 Tested it and works for me. 测试它并适合我。 I believe those assemblies were only introduced in .NET 4. The types in System.Xaml, for example, are defined some place else in .NET 3.5 (like PresentationCore for example). 我相信这些程序集仅在.NET 4中引入。例如,System.Xaml中的类型在.NET 3.5中的其他位置定义(例如,像PresentationCore)。 See this article for more info. 有关详细信息,请参阅此文章

Remove these references altogether. 完全删除这些引用。 If you still need them, re-add them through the UI in Visual Studio. 如果您仍然需要它们,请通过Visual Studio中的UI重新添加它们。 You should see the 3.5 versions or 2.0 versions of those assemblies. 您应该看到这些程序集的3.5版本或2.0版本。 By using those older versions, your app should compile. 通过使用这些旧版本,您的应用程序应该编译。

您必须在references文件夹中删除这些引用,并使用3.5版本读取它们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM