Being a Process Consultant specializing in TFS I teach many companies how to use Team Build. When you create a new build definition you have the option to set “Configurations to Build”. However, if you leave that value blank the build will build the “default” configuration. The questions I am inevitability ask are “what is the default configuration” and “how do we set the default configuration”? Well in this post I will show you where it is stored and how to update it for typical Visual Studio 2012 project.
Visual Studio projects are msbuild scripts and because of that we can set properties in the actual project files that are going to be sent to msbuild to be compiled. To change the default configuration you we need to load the project file as xml which is the file format of msbuild. With the project open in Visual Studio simply right click on the desired project and select “Unload Project” from the context menu. Once the project is unloaded right click on it again and select “Edit [Project Name]” and Visual Studio will open the file as an xml file we can edit. Search the file for a “Configuration” element in a property group (it is normally the first group). It should look similar to this:
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
This is the line responsible for setting the default configuration of your build. Simply change “Debug” to the desired default configuration, save the file then right click on project file in Solution Explorer and select “Reload Project”. After you check in your changes an queue a new build it will be built using this configuration if the “Configurations to Build” is blank in the build definition.