Removing Debug and Release Configurations from Vis

2019-06-03 14:56发布

问题:

I modified the default Debug configuation, so that the output directories resemble $(SolutionDir)$(PlatformName)/$(ConfigurationName).

Next, I created debug variations, DebugStatic and DebugDll, to be more explicit about the target being created. I created them by copying the Debug configuration.

In similar fashion, I created ReleaseDLL and ReleaseStatic from the modified Release configuration.

Using Configuration Manager, I removed the Debug and Release configurations.

The Debug and Release configurations still show up in the Batch Build window and also in the Configuration drop down box in the Property Pages window (displayed from right clicking on the project name, then selecting Properties).

How do I cleanse, wipe-out, erase, obliterate, the Debug and Release configurations?

(The ambiguity of Debug has caused me many weeks of problem solving, especially when accidentally combining a Win32 debug DLL in an X64 project)
(I searched the web and StackOverflow, but didn't find anything about completely removing those configurations.)

回答1:

Solution and Project debug/release configurations are different.

Solution configurations may be controlled by configuration manager (Active Solution Configuration) and project configuration again can be controlled in the same manager for each project separately(project context)

In the image above, you can click on a project configuration, select edit and then you can remove the configuration.



回答2:

Note that to clear this from VS Batch build you must manually delete the property groups for DEBUG & RELEASE configurations from the project file XML.

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <OutputPath>bin\Debug\</OutputPath>
    <BuildScriptName>$(MSBuildProjectName).sql</BuildScriptName>
    <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <DefineDebug>true</DefineDebug>
    <DefineTrace>true</DefineTrace>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>



回答3:

You should clear the configurations within the .SLN file

GlobalSection(SolutionConfigurationPlatforms) = preSolution
    **Undesired Debug**|Any CPU = Debug|Any CPU
    Debug|Any CPU = Debug|Any CPU
    Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
    {CE94D753-36C5-45FA-870A-4D61DAC98B71}.**Undesired Debug** .Net Native (Debug)|Any CPU.ActiveCfg = Debug|Any CPU
    {4EFA1043-8E1B-4950-8167-C77ABE626F1E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
    {4EFA1043-8E1B-4950-8167-C77ABE626F1E}.Debug|Any CPU.Build.0 = Debug|Any CPU
    {4EFA1043-8E1B-4950-8167-C77ABE626F1E}.Release|Any CPU.ActiveCfg = Release|Any CPU
    {4EFA1043-8E1B-4950-8167-C77ABE626F1E}.Release|Any CPU.Build.0 = Release|Any CPU
    {28D34A34-6E07-4FC3-A4B3-C704C1C5C7CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
    {28D34A34-6E07-4FC3-A4B3-C704C1C5C7CE}.Debug|Any CPU.Build.0 = Debug|Any CPU
    {28D34A34-6E07-4FC3-A4B3-C704C1C5C7CE}.Release|Any CPU.ActiveCfg = Release|Any CPU
    {28D34A34-6E07-4FC3-A4B3-C704C1C5C7CE}.Release|Any CPU.Build.0 = Release|Any CPU
    {6B71D000-AC8D-49AF-ADA6-D96C7ECFF093}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
    {6B71D000-AC8D-49AF-ADA6-D96C7ECFF093}.Debug|Any CPU.Build.0 = Debug|Any CPU
    {6B71D000-AC8D-49AF-ADA6-D96C7ECFF093}.Release|Any CPU.ActiveCfg = Release|Any CPU
    {6B71D000-AC8D-49AF-ADA6-D96C7ECFF093}.Release|Any CPU.Build.0 = Release|Any CPU
    {CE94D753-36C5-45FA-870A-4D61DAC98B71}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
    {CE94D753-36C5-45FA-870A-4D61DAC98B71}.Debug|Any CPU.Build.0 = Debug|Any CPU
    {CE94D753-36C5-45FA-870A-4D61DAC98B71}.Release|Any CPU.ActiveCfg = Release|Any CPU
    {CE94D753-36C5-45FA-870A-4D61DAC98B71}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection