简体   繁体   English

如何在VS2010中创建与.NET2兼容的应用程序?

[英]How to create .NET2 compatible app in VS2010?

I'm using Microsoft Visual Studio 2010 and .NET4, but I would like to create application(Windows Form Application) that can be also run in .NET2. 我正在使用Microsoft Visual Studio 2010和.NET4,但我想创建也可以在.NET2中运行的应用程序(Windows窗体应用程序)。 The reason is that I want it to be very easy to use and portable across many machines and not everybody has .NET4 installed. 原因是我希望它非常易于在许多机器上使用和移植,而不是每个人都安装了.NET4。

Can I do it or do I need to install older version of Visual Studio? 我可以这样做还是需要安装旧版本的Visual Studio? Is so what version is the best for most portable .NET app. 因此,哪种版本最适合大多数便携式.NET应用程序。

You can modify the target framework in the properties of the project: 您可以在项目的属性中修改目标框架:

在此输入图像描述

You can select which .NET Framework version you want to target when you create a new project. 您可以在创建新项目时选择要定位的.NET Framework版本。 If you want to change the framework of an existing project, do what Darin has illustrated. 如果要更改现有项目的框架,请执行Darin演示的操作。

Just modify the target framework by looking at the propeties of the solution you are working on. 只需通过查看正在使用的解决方案的特性来修改目标框架即可。

I would highly advise you to target .NET 3.5 just based on the age of .NET 2.0. 我强烈建议您仅根据.NET 2.0的年龄来定位.NET 3.5。

.NET Framework 2.0 was attached to Visual Studio 2005. .NET Framework 2.0已附加到Visual Studio 2005。

通过修改目标框架是一种方法,但是如果您考虑可移植性,则可能需要的是可以在每个Windows版本中使用的某种本机代码。

Don't forget to delete redundant namespaces from your namespace list. 不要忘记从名称空间列表中删除冗余的名称空间。 For example LINQ... 例如LINQ ...

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

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