Reputation: 3635
I often create custom build configurations in my solution's Configuration Manager. When I include previously created projects into the solution they do not automatically include these new configurations. The only way I have found to back fill these projects with the appropriate configuration settings is to manually edit the project file.
Is there a way to force all projects in a solution to all use the same set of Configuration Manager configurations?
Upvotes: 7
Views: 8561
Reputation: 2721
I just had the same issue and here is how I fixed it.
First close Visual Studio and find the project guid from new projects. Your can do this by looking in your .csproj
file. Then open the solution file in a text editor like Notepad++.
In the solution file, find the section called GlobalSection(ProjectConfigurationPlatforms) = postSolution
.
Each of your projects will have a listing there with the configuration. You will notice that your new projects likely already have settings for your configurations, BUT they will be set to DEBUG or RELEASE as shown in the example below.
{2E6B7D61-640E-4878-BE6D-7CD705AB9A6A}.Staging|Any CPU.ActiveCfg = Debug|Any CPU
{2E6B7D61-640E-4878-BE6D-7CD705AB9A6A}.Staging|Any CPU.Build.0 = Debug|Any CPU
{2E6B7D61-640E-4878-BE6D-7CD705AB9A6A}.Live|Any CPU.ActiveCfg = Debug|Any CPU
{2E6B7D61-640E-4878-BE6D-7CD705AB9A6A}.Live|Any CPU.Build.0 = Debug|Any CPU
To fix this, change the Debug|Any CPU
to be instead your configuration. So in my example above my settings will become the following:
{2E6B7D61-640E-4878-BE6D-7CD705AB9A6A}.Staging|Any CPU.ActiveCfg = Staging|Any CPU
{2E6B7D61-640E-4878-BE6D-7CD705AB9A6A}.Staging|Any CPU.Build.0 = Staging|Any CPU
{2E6B7D61-640E-4878-BE6D-7CD705AB9A6A}.Live|Any CPU.ActiveCfg = Live|Any CPU
{2E6B7D61-640E-4878-BE6D-7CD705AB9A6A}.Live|Any CPU.Build.0 = Live|Any CPU
Save the changes and then relaunch Visual Studio and open your solution.
Upvotes: 2
Reputation: 15861
I found that removing all the configurations and than adding them back in again fixes all the projects in the solution
Upvotes: 15
Reputation: 1888
The VS2010 "Export Template Wizard" extension will work for this situation. You will have to create a project and set up all of your configuruations, files, etc. Then export it as a Template. When you start a new project you can select your new template and the settings in the Configuration Manager will carry over. I created a simple test project and this worked. This will not account for any projects that you have already created.
This blog post by DevGuy has a walk through with pictures on the process.
Upvotes: 3
Reputation: 499382
You could write a Visual Studio macro that does this for you. Bind it to a menu button and you have a one-click way to add these configurations to a project.
Upvotes: 0