Reputation: 3347
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.
Upvotes: 59
Views: 41342
Reputation: 11
VS2022 now provides the check box to "Remove deleted configurations from all projects where it is unused." on the "Edit Solution Configurations" screen.
Copied from how-do-i-remove-a-project-configuration-in-visual-studio-2008
Edited
You can see the dialog below at the 3rd step given by Mike's answer.
"Edit Solution Configurations" having a checkbox!
Upvotes: 0
Reputation: 10486
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.
Copy and past the following command in the console to remove the build from all the projects. You may want to replace "Release" with the configuration name you wish to delete.
Get-Project -All | Foreach { $_.ConfigurationMAnager.DeleteConfigurationRow("Release") }
Finally, remove the configuration solution-wise as explained by Mike Grimm's answer.
Upvotes: 29
Reputation:
I know I am bit Late but here is complete solution. To remove configuration completely from solution and project property then open .sln file in any IDE as Plain text and delete all information regarding the configuration. NOTE- don't delete GUID values and debug/release configurations Then open .vcxproj file in XML format and delete all information regarding the configuration. This includes fundamental property for it, Platform Toolset and Assosiated property elements in XML language. NOTE- make sure to delete end tags. when you go back to visual studio, click replace all and you are good to go.
Upvotes: 0
Reputation: 41
You need to remove the configuration from the solution AND the project. From the Configuration Manager:
Upvotes: 4
Reputation: 2601
In Visual Studio for MAC -
Upvotes: 0
Reputation: 2079
In my case the issue was that the solution file was not in the same folder as project file so I had to copy the nuget folder into the solution folder to resolve this issue.
Upvotes: 0
Reputation: 1254
Access the configuration manager in one of two ways:
Build
> Configuration Manager...
Configuration Manager...
In the configuration manager dialog under Active solution configuration:
choose <Edit...>
from the drop down.
A dialog opens showing all the configurations for your solution. Here you can select and click the Remove
button.
Upvotes: 104
Reputation: 663
I know this is an old thread, but this was the answer for me:
In the Configuration Manager, select "Edit..." in the "Configuration" column for each project (not via the dropdown named Active solution configuration) that has configurations you want to remove.
In the dialog that pops up, mark each unwanted configuration and select "Remove".
Copied from How do I remove a project configuration in Visual Studio 2008?
Upvotes: 27
Reputation: 1097
Upvotes: 36
Reputation: 3347
I solved this with utility which parses csproj files and inserts necessary propertygroup blocks into csproj files. Old project configurations still appear in configuration manager but I gave up trying to delete them.
Upvotes: 3