I'm writing a VS Extension for VS 2017, and need to remove a Solution Folder and its contents from the solution. I have been unable to find much documentation aside from using ProjectItem.Remove to remove items from a project and Project.Delete to remove a project from the solution. However, calling each of these methods results in the following exception:
The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))
What is the proper way to delete Solution Folders in an extension?
A Solution Folder is a project in a given solution like any other project.
To remove a project from a solution, you cannot call
proj.Delete() which is not implemented as per official documentation:
Removes the project from the current solution.
Note that this method is not currently implemented.
Instead, you must must use
dte.Solution.Remove(proj); and that should work for solution folders as well.
User contributions licensed under CC BY-SA 3.0