title: Get all methods that are decorated with a specific attribute using T4/EnvDTE
body: <p>I'd like to get a list of all public methods in my project that are decorated using <code>MyAttribute</code> using T4/EnvDTE.</p>
  
  <p>I know this can be done with reflection, but I don't want to load the assembly and reflect over it in a T4 template, rather, I want to use the existing code files as the source.</p>
  
  <p>The following is boilerplate code I found on the internet that gets a reference to the current project</p>
  
  <pre><code>&lt;#@ template debug="true" hostspecific="true" language="C#" #&gt;
  &lt;#@ assembly name="EnvDTE" #&gt;
  &lt;#@ assembly name="System.Core.dll" #&gt;
  &lt;#@ import namespace="System.Linq" #&gt;
  &lt;#@ import namespace="System.Collections.Generic" #&gt;
  &lt;#@ import namespace="System.IO" #&gt;
  &lt;#@ output extension=".cs" #&gt;
  
  &lt;#
      IServiceProvider _ServiceProvider = (IServiceProvider)Host;
      if (_ServiceProvider == null)
          throw new Exception("Host property returned unexpected value (null)");
  
      EnvDTE.DTE dte = (EnvDTE.DTE)_ServiceProvider.GetService(typeof(EnvDTE.DTE));
      if (dte == null)
          throw new Exception("Unable to retrieve EnvDTE.DTE");
  
      Array activeSolutionProjects = (Array)dte.ActiveSolutionProjects;
      if (activeSolutionProjects == null)
          throw new Exception("DTE.ActiveSolutionProjects returned null");
  
      EnvDTE.Project dteProject = (EnvDTE.Project)activeSolutionProjects.GetValue(0);
      if (dteProject == null)
          throw new Exception("DTE.ActiveSolutionProjects[0] returned null");
  
  #&gt;
  </code></pre>