Skip to content

Instantly share code, notes, and snippets.

@kad1r
Created April 16, 2013 21:01
Show Gist options
  • Save kad1r/5399620 to your computer and use it in GitHub Desktop.
Save kad1r/5399620 to your computer and use it in GitHub Desktop.
Get all projects in the solution with C#
public static List<string> GetSolutionList()
{
List<string> prj = new List<string>();
// "VisualStudio.DTE.11.0"
// this represents your visual studio version
// 11.0 means vs2012
// 10.0 means vs2010
// 9.0 means vs2005
for (int i = 1; i < ((EnvDTE.DTE)System.Runtime.InteropServices.Marshal.GetActiveObject("VisualStudio.DTE.11.0")).Solution.Projects.Count + 1; i++)
{
prj.Add(((EnvDTE.DTE)System.Runtime.InteropServices.Marshal.GetActiveObject("VisualStudio.DTE.11.0")).Solution.Projects.Item(i).Name);
}
return prj;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment