.net 更改默认目标框架 Visual Studio 2010

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4595212/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-03 15:05:35  来源:igfitidea点击:

Changing the Default Target Framework Visual Studio 2010

.netvisual-studio-2010

提问by Achilles

Is there a way in Visual Studio 2010 to change the default target framework that projects point to when they are created? I want to target the 4.0. framework by default and NOT the Client Profile version of the 4.0 framework.

Visual Studio 2010 中有没有办法更改项目在创建时指向的默认目标框架?我想以 4.0.0 为目标。框架默认情况下,而不是 4.0 框架的客户端配置文件版本。

采纳答案by MrEyes

Visual Studio 2010 (and older versions) will remember the last target framework you chose when using File -> New -> New Project. So if you create a new project using 4.0, the next time you create a new project 4.0 will be preselected as the target framework.

Visual Studio 2010(和旧版本)将记住您在使用File -> New -> New Project. 因此,如果您使用 4.0 创建新项目,则下次创建新项目时,4.0 将被预选为目标框架。

EDIT : Further to comment below:

编辑:进一步评论下面:

Having looked at this a little more there is another solution that is slightly less faffy than the info on the link I posted in the comments below.

多看了一点,还有另一种解决方案比我在下面的评论中发布的链接上的信息稍微少一点。

Create a new solution/project with the setup you need, then goto File -> Export Template. After you have done there you can then use your new template when you go File -> New -> New Project.

使用您需要的设置创建一个新的解决方案/项目,然后转到File -> Export Template。在那里完成后,您可以在去时使用新模板File -> New -> New Project

Seems to work, not thoroughly tested it though.

似乎工作,虽然没有彻底测试它。

回答by BlackICE

There is a way to change it by hacking the template:

有一种方法可以通过破解模板来更改它:

http://blog.rolpdog.com/2010/04/changing-default-framework-profile-in.html

http://blog.rolpdog.com/2010/04/changed-default-framework-profile-in.html

Which is probably close to the same as MrEyes answer.

这可能与 MrEyes 的回答接近相同。

回答by evilbhonda

I know the question was originally for VS2010, but in Visual Studio 2015, it's much easier to change the target framework by default.

我知道这个问题最初是针对 VS2010 的,但是在 Visual Studio 2015 中,默认情况下更改目标框架要容易得多。

When adding a new project, change the framework at the top -

添加新项目时,更改顶部的框架-

Select framework when adding a project

添加项目时选择框架

When you come to add another project, I've found that VS remembers the last selection I made.

当您添加另一个项目时,我发现 VS 会记住我所做的最后一个选择。

回答by Jerry

In my VS 2010, I right-click on the project, select Properties, select the Compile tab, scroll down to the Advanced Compile Options button and click on it. The Advanced Compile Settings window appears. The last drop-down in that window is a list for target framework.

在我的 VS 2010 中,我右键单击该项目,选择“属性”,选择“编译”选项卡,向下滚动到“高级编译选项”按钮并单击它。出现高级编译设置窗口。该窗口中的最后一个下拉列表是目标框架的列表。

回答by Jiby Matthews

Its as easy as in your Visual studio.

它就像在您的 Visual Studio 中一样简单。

  1. Go to the 4th menu option on top, 'website'.

  2. Under websites go to option, 'start options'.

  3. Under start options, go to 'build' option.

  4. Change the target framework there to what so ever framework.

  1. 转到顶部的第四个菜单选项,“网站”。

  2. 在网站下转到选项,“开始选项”。

  3. 在开始选项下,转到“构建”选项。

  4. 将那里的目标框架更改为任何框架。

回答by JasCav

Here is how you do it with VS2008. It appears to be a similar (the same?) process for VS2010. (I just did it in my own VS2010 development environment.)

以下是您如何使用 VS2008 进行操作。这似乎是 VS2010 的类似(相同?)过程。(我只是在我自己的 VS2010 开发环境中做的。)

  • Right click on the name of the project.
  • Click the Application tab.
  • In the 'Target Framework' list, select the framework that you wish to use. It will differ depending on which .NET frameworks you have available on your system.
  • 右键单击项目名称。
  • 单击应用程序选项卡。
  • 在“目标框架”列表中,选择您要使用的框架。它会因系统上可用的 .NET 框架而异。