当在Visual Studio中添加新的C#项目,不会自动创建其他配置 [英] When adding new C# projects in Visual Studio, additional configurations are not created automatically

查看:300
本文介绍了当在Visual Studio中添加新的C#项目,不会自动创建其他配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有我添加了一个新的解决方案配置一个Visual Studio C#的解决方案。

I have a Visual Studio C# solution which I have added a new solution configuration to.

当我在解决方案中创建新的项目,他们有调试和发布仅配置。

When I create new projects in the solution they have Debug and Release configurations only.

他们为何不有附加的配置?

Why do they not have the additional configurations?

推荐答案

Understanding构建配置说:

默认情况下,使用Visual Studio创建的项目包括调试和发布配置即可。调试配置自动
配置调试应用程序,并发布配置
配置为应用程序的最终版本。

By default, projects created with Visual Studio include Debug and Release configurations. Debug configurations are automatically configured for debugging an application, and Release configurations are configured for the final release of an application.

所以,基本上,每次一个新的项目添加到解决方案,您可以选择新的Visual Studio项目从一组预先存在的项目模板,其中只有调试和Release配置类型。

So, basically, every time you add a new project to the solution, you choose the type of your new Visual Studio project from a set of preexisting project templates, which only have the Debug and Release configurations.

Visual Studio中可以导出自己的项目模板,并随后将其用于创建新项目。

Visual Studio allows you to export your own project templates and use them subsequently for creating new projects.

你可以做的是


  1. 创建类型的新的空项目,你需要创建(类库控制台应用程序的等等)。

  2. 所需的项目配置加入到这个项目中(让我们将其命名为测试的)。

  3. 命名它的 MyTemplate的的后导出模板。另外,还要确保的自动导入模板到Visual Studio 的复选框被选中。

  4. 返回到原来的解决方案,并通过从列表中选择它添加项目可用模板 - MyTemplate的的(现在将上市)

  1. Create a new empty project of the type that you need to create (Class Library, Console Application etc).
  2. Add the desired project configuration to this project (let's name it Test).
  3. Export the template after naming it MyTemplate. Also make sure that the Automatically import the template into Visual Studio checkbox is checked.
  4. Go back to your original solution and add the project by choosing it from the list of available templates - MyTemplate (which now will be listed).

您将拥有的测试的可作为一个自定义的项目配置。

You will have the Test available as a custom project configuration.

[更新]

另外,你应该知道,它也可以创建自己的Visual Studio加载项可能给你更多的自由来创建基于模板的项目和自动化生成。看看下面的例子:

Alternatively, you should know that it's also possible to create your own Visual Studio Add-ins which could give you more freedom for creating projects based on templates and for automating builds. Check out the following examples:

如何:以编程方式创建项目

如何:创建解决方案和项目构建配置

这篇关于当在Visual Studio中添加新的C#项目,不会自动创建其他配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆