Introduction
When you have a lot of projects, and create a "Blank Solution" on Visual Studio, you need to add the projects one by one,
selecting the "*.csproj", because the VS dont allow to add more than one project at same time to the solution.
Using this addin, you can select the projects root folder, and it will search for projects and show it in a grid, and you can select then and the VS Solution will be created.
Using the code
Creating a AddIn project in VS2010 you will be able to do something like this:
public void Exec(string commandName, vsCommandExecOption executeOption,
ref object varIn, ref object varOut, ref bool handled)
{
handled = false;
if(executeOption == vsCommandExecOption.vsCommandExecOptionDoDefault)
{
if(commandName == "SlnCreator.Connect.SlnCreator")
{
handled = true;
Menu m = new Menu();
if (m.ShowDialog() == DialogResult.OK)
{
List<string> files = m.Paths;
List<string> solFolders = new List<string>();
string solName = m.SolutionPath;
bool createSolFolder = m.CreateSolFolders;
Solution2 s = (Solution2)_applicationObject.Solution;
Project prj;
SolutionFolder sf = null;
s.Create(Path.Combine(Path.GetDirectoryName(solName),
Path.GetFileNameWithoutExtension(solName)),
Path.GetFileNameWithoutExtension(solName));
foreach (string file in files)
{
if (createSolFolder)
{
string solFolder = GetSolutionFolderName(file);
if (solFolders.Contains(solFolder) == false)
{
solFolders.Add(solFolder);
prj = s.AddSolutionFolder(solFolder);
sf = (SolutionFolder) prj.Object;
sf.AddFromFile(file);
}
else
{
sf.AddFromFile(file);
}
}
else
{
s.AddFromFile(file);
}
}
Directory.CreateDirectory(Path.GetDirectoryName(solName));
s.SaveAs(solName);
return;
}
}
}
}