Currently in my GAT Guidance Package, I have a solution template that includes several projects. Currently, the projects all unfold into project folders at the root of the soution folder, and appear under the root of the solution file in the VS solution explorer:
..\SolutionFolder\MySolution.sln
..\SolutionFolder\Project1\Project1.csproj
..\SolutionFolder\Project2\Project2.csproj
What I'd like to have happen is that when the solution unfolds, I'd like to have the projects in my solution divdided into solution folders. However, I do NOT wnat this to be reflected in the file system, and therefore do not use the <SolutionFolder> element in my solution .vstemplate file.
The approach that I am workin with right now is:
1. I have an Action called "CreateSolutionFolderAction", which I use to programatically create the solution folder(s) I need.
2. I have another action called "MoveProjectAction", which takes a SourceProject (and EnvDTE.Project) and a DestinationFolder (an EnvDTE80.SolutionFolder).
The problem is that I cannot figure out how to move the project in the MoveProjectAction.Execute() method. I have tried using:
string projectFile = sourceProject.FullName;
mySolution.Remove(sourceProject); //mySolution is an EnvDTE80.Solution2
destinationFolder.AddFromFile(projectFile);
This works, but has the undesiredable side-effects of destroying the references that are "by project", and changing the solution startup project.
Is there another way to move projects around within a solution that I am not aware of?