简体   繁体   English

C#向后兼容性

[英]C# backwards compatibility

  1. I am using windows 7 running .net 4.0 我正在使用运行.net 4.0的Windows 7
  2. I wrote an application on my platform then distributed it to my coworkers. 我在我的平台上写了一个应用程序,然后将它分发给我的同事。
  3. They are using windows XP .net 3.0 and 3.5 他们使用的是Windows XP .net 3.0和3.5
  4. They can not update to .net 4 for business reasons. 出于商业原因,他们无法更新到.net 4。
  5. I am running Visual studio 2010 我正在运行Visual Studio 2010

How can i make my application backwards compatible so that they can use it? 如何使我的应用程序向后兼容以便他们可以使用它?

If you don't use any .NET 4 specific features, just target 3.0 or 3.5. 如果您不使用任何.NET 4特定功能,请仅定位3.0或3.5。 That will solve any compatibility problems. 这将解决任何兼容性问题。 Here's a link on MSDN detailing how to do it: 这是MSDN上的一个链接,详细说明了如何执行此操作:

  • On the Project menu, click ProjectName Properties. 在项目菜单上,单击ProjectName属性。
  • Click the Application tab. 单击应用程序选项卡。
  • In the Target Framework list, select either .NET Framework 2.0, .NET Framework 3.0, or .NET Framework 3.5. 在“目标框架”列表中,选择“.NET Framework 2.0”,“.NET Framework 3.0”或“.NET Framework 3.5”。

Don't use .NET 4.0 features and set the target framework to .NET 3.5 on your project. 不要使用.NET 4.0功能并将目标框架设置为项目中的.NET 3.5。 Then rebuild and redistribute. 然后重建并重新分配。 How to do it: 怎么做:

  • In Visual Studio, open the project you want to change. 在Visual Studio中,打开要更改的项目。

  • Right-click the project in Solution Explorer and then click Properties. 在解决方案资源管理器中右键单击项目,然后单击“属性”

  • In the Project Designer, locate the Target Framework list, as follows. 在项目设计器中,找到“目标框架”列表,如下所示。

  • For Visual C# projects, the Target Framework list is on the Application tab of the Project Designer. 对于Visual C#项目,目标框架列表位于项目设计器的“应用程序”选项卡上。 For more information, see Application Page, Project Designer (C#). 有关更多信息,请参阅应用程序页面,项目设计器(C#)。

  • In the Target Framework list, select the .NET Framework version or profile that you want. 在“目标框架”列表中,选择所需的.NET Framework版本或配置文件。

More detailed information here . 这里有更详细的信息。

Also, about don't using 4.0 features, you can read more about what C# features here . 此外,关于不使用4.0功能,您可以在此处阅读有关C#功能的更多信息。

在项目中定位.Net v3.51框架

Only use features supported by .net 3.5. 仅使用.net 3.5支持的功能。 Don't use any .net 4.0+ features. 不要使用任何.net 4.0+功能。

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

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