#497 – Creating a New Build Configuration in a Project
January 13, 2012 3 Comments
In Visual Studio, you manage both build configurations, for each project, and solution configurations. The project-level configurations specify sets of build options. The solution-level configurations specify which project-level configurations are associated with each solution configuration.
You create and edit both project-level and solution-level configurations from the Configuration Manager.
To create a new project-level configuration, you select <New…> from the Configuration dropdown for a specific project.
You then give the new configuration a name and, optionally, copy settings from an existing configuration.
By default, this will create an identically named solution-level configuration. You can uncheck the Create new solution configurations option to avoid this. There are cases when you don’t necessarily want a one-to-one mapping between solution-level and project-level configurations. In the example below, we’ve created a DebugWithWarningsAsErrors option, set appropriate project properties, and then build only one project with this configuration.
First of all let me star by saying I really like this series but I feel like lately you have been focusing on visual studio features rather than c# language feature. This does not mean that this tips are not usefull its just that I feel they do not qualify as “things you should know about c#”.
Thanks for the note Samir. We’ll get back to “pure” C# shortly, but the philosophy of this blog is to focus mainly on the language, but also present information on basic tools that you need if you want to be a professional C# programmer. Visual Studio is the tool that most professional C# programmers will be using and so I think it’s important to cover it. Maybe not all the esoteric aspects of the tools, but at least the very basics that support your use of C#. In the case of solution and build configurations, I cover that because I’m also talking about C# directives like #if, which rely on the ability to define conditional compilation symbols in a build configuration. I realize that someone could create C# code in a text editor and compile from the command line, but that’s not how most developers will use the language.
Pingback: #498 – Creating a New Solution Configuration « 2,000 Things You Should Know About C#