It is necessary to move the project from the Solution
to SolutionFolder
. I am trying to remove the project from the solution and add it back into the folder using EnvDTE
SolutionFolder.AddFromFile(Filepath line);
because not found in the documentation how move projects in the solution (or install a new parent for project). But with the addition of projects in such a way in MRU list(start page, and windows start menu)appear this projects.
How to move a project to SolutionFolder without adding to MRU list?
sry for bad english
adding function as it is at this moment:
protected Project AddProjectToSolutionFolder(Project project1, SolFolderTypes solutionFolderType)
{
try
{
Solution2 solution = (Solution2)((DTE2)base._dteObject).Solution;
string projFullname = project1.FullName;
string solutionFolderName = solutionFolderType == SolFolderTypes.Folder1 ? "Folder1" : "Folder2";
Project project = GetSolutionSubFolder(solution, solutionFolderName);
if (project != null)
{
SolutionFolder folder = (SolutionFolder)project.Object;
solution.Remove(project1);
project1 = folder.AddFromFile(projFullname);
}
}
catch (Exception e)
{
}
return project1;
}
private static Project GetSolutionSubFolder(Solution2 solution, string subfolder)
{
Projects projects = solution.Projects;
Project folder = projects.Cast<Project>().FirstOrDefault(p => string.Equals(p.Name, subfolder));
if (folder == null)
folder = solution.AddSolutionFolder(subfolder);
return folder;
}