How to define custom configurations in new-style .csproj?
I'm trying to update some projects from old-style .csproj:
<?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> etc.
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop"> etc.
One group of projects has a custom configuration, in addition to the standard
Release. After I convert a project from this group, VS gives an error message:
Current solution contains incorrect configuration mappings. It may cause projects to not work correctly. Open the Configuration Manager to fix them. [Open Configuration Manager]
(where the square brackets represent a button). If I click the button, or open the configuration manager by other means, it updates the .sln file to use
Debug instead of the custom configuration in the converted project.
What I've tried
I've tried using the configuration manager to create a new configuration for the project, copying from Debug: this does absolutely nothing, not even an error dialog telling me that it can't do it.
I've tried adding a stanza to the converted .csproj to try to "define" the configuration:
<PropertyGroup Condition="'$(Configuration)' == 'Dev Cloud'"> <DefineConstants>TRACE;DEBUG;DEVCLOUD</DefineConstants> <Optimize>false</Optimize> <DebugType>full</DebugType> <ErrorReport>prompt</ErrorReport> <Prefer32Bit>true</Prefer32Bit> <DebugSymbols>true</DebugSymbols> </PropertyGroup>
This also fails to achieve anything.