Visual studio - can't remove project configurations


I have a major problem with project configurations. Everything started when I wanted to add new solution configuration (named "Dev_WithSource") based on existing "Debug" configuration and checked "Create project configurations". For some reason project configurations were registered inside sln file, properly showing in Configuration manager, but "PropertyGroup Condition" blocks in csproj files weren't created. That resulted in "OutputPath not set ..." error.

So, I tried to repeat whole procedure. After deleting all lines mentioning "Dev_WithSource" from sln file, "Dev_WithSource" project configurations are still showing in configuration manager. I searched all csproj and sln file in my solution. Neither of them contain text "Dev_WithSource".

After all that I event tried developing add-in. I can fetch phantom configurations with project.ConfigurationManager.ConfigurationRowNames but I also can't delete them. Am I missing something? Are those configurations stored in some other files and not csproj/sln?

Thanks.


Solution 1:

  1. Access the configuration manager in one of two ways:

    1. From the menus on top: Build > Configuration Manager...
    2. From the drop down listing your configurations on the main tool bar select Configuration Manager...
  2. In the configuration manager dialog under Active solution configuration: choose <Edit...> from the drop down.

    Configuration Manager

  3. A dialog opens showing all the configurations for your solution. Here you can select and click the Remove button.

    Edit Solution Configurations

Solution 2:

  1. Right-click->Unload your project with the configurations you want to remove.
  2. Right-click->Edit project file xml directly.
  3. Delete the Property groups containing conditions containing the name of the platforms/configurations you wish gone.
  4. Save and load project again. Unwanted configurations should be gone.
  5. If a configuration seems set up right but OutPutPath is still "not set", try moving its propertygroup tag up in the xml.

Solution 3:

Let's suppose you want to remove "Release" configuration from the entire solution and the projects. So, first you go to Tools -> Nuget Package Manager -> Package Manager Console. From that console use the following command to remove the build from all the projects in the solution :

Get-Project -All | Foreach { $_.ConfigurationMAnager.DeleteConfigurationRow("Release") }

Then you remove it solution-wise as explained by Mike Grimm.