title: How to get list of projects in current Visual studio solution?
body: <p>When we open Package Manager Console in any open solution, it shows all the projects of that solution. How it is loading all the projects of the same solution. 
  When I tried with below shown code it is fetching me projects of the first solution which I have opened.</p>
  
  <pre><code>    private List&lt;Project&gt; GetProjects()
      {
          var dte = (DTE)Marshal.GetActiveObject(string.Format(CultureInfo.InvariantCulture, "VisualStudio.DTE.{0}.0", targetVsVersion));
          var projects = dte.Solution.OfType&lt;Project&gt;().ToList();
          return projects;
      }
  </code></pre>