-
Hi. Is there a way to delete a project from the solution using the toolkit? For instance, the below code is using a mix of the toolkit and the "old" DTE object, but the conversion is invalid: var project = await ItemHelper.FindProjectAsync("api"); //use VS... It would be helpful to have this functionality in the toolkit, mainly for convenience, but also because it seems like there exist 3-4 ways to remove a project, and it's difficult to estimate which one to use. If it's not planned to be added, is there a way I can remove the project via a mix of the toolkit and existing functionality? Br. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
IVsSolution.CloseSolutionElement is the method that you need to use.
Here's an example using the toolkit: Project? activeProject = await VS.Solutions.GetActiveProjectAsync();
if (activeProject != null) {
IVsSolution solution = await VS.Services.GetSolutionAsync();
activeProject.GetItemInfo(out IVsHierarchy hierarchy, out _, out _);
solution.CloseSolutionElement(0, hierarchy, 0);
} |
Beta Was this translation helpful? Give feedback.
-
Great, thank you! I would never have guessed that it was called CloseSolution :-) |
Beta Was this translation helpful? Give feedback.
-
Perhaps we should add a more friendly way to do this from the toolkit's |
Beta Was this translation helpful? Give feedback.
IVsSolution.CloseSolutionElement is the method that you need to use.
Here's an example using the toolkit: