We have a VisualStudioWorkspace with all the projects that are open in Visual Studio. Now we would like to create a new AdhocWorkspace object, with a limited set of the projects in the VisualStudioWorkspace.
Is it somehow possible to copy projects from the existing VisualStudioWorkspace to the new AdhocWorkspace? At first sight it's only possible to add new empty projects (using adhocWorkspace.AddProject()).
foreach (var p in vsWorkspace.CurrentSolution.Projects)
{
if (condition)
{
adhocWorkspace.AddProject(p);
^ doesn't work, p must be of type ProjectInfo, instead of Project
}
}