title: Accessing Projects via DTE in C# T4 Template
body: <p>I'm currently trying to iterate over all of my projects (sharepoint) to get all feature guids into an file. there i want to prefix them with the projects name. My problem is DTE.Solution.Item and DTE.Solution.Projects.Item (or the enumerators for foreach) will not take an integer as parameter and foreach returns an object which is not castable to Project.</p>
  
  <p>Here is my code snippet:  </p>
  
  <pre><code>var hostServiceProvider = (IServiceProvider) Host;
  var dte = (DTE) hostServiceProvider.GetService(typeof(DTE));
  var projectCount = dte.Solution.Projects.Count;
  
  var projects = new Dictionary&lt;string, string&gt;();
  
  foreach(Project dteProject in dte.Solution)
  {
      var dteProject = dte.Solution.Item(i);
      projects.Add(dteProject.Name, dteProject.FullName);
  }
  </code></pre>
  
  <p>Okay - the code is alright - the debugger is NOT!
  My Exceptions where thrown in a debug context, but the Template will run fine, if the debugger is not attached.</p>