title: How to export all the source code from Visual Studio into a text file?
body: <p>I have a relatively large Visual Studio solution. </p>
  
  <p><strong>I need to export all the source code into a text file. I would also want to include a file name somewhere. How can I do so?</strong> </p>
  
  <p>For example if I have a type</p>
  
  <pre><code>namespace MyProject.Core
  {
      /// &lt;summary&gt;
      ///   Enumerates possible record status
      /// &lt;/summary&gt;
      public enum RecordType
      {
          NonWearTime = 0,
          WearTime = 1,
          NotClassified = 2
      }
  }
  </code></pre>
  
  <p>I want this to go to the <code>output.txt</code> file (or any other text format) and appear like so</p>
  
  <pre><code>//***********************************
  //Filename: RecordType.cs
  //***********************************
  namespace MyProject.Core
  {
      /// &lt;summary&gt;
      ///   Enumerates possible record status
      /// &lt;/summary&gt;
      public enum RecordType
      {
          NonWearTime = 0,
          WearTime = 1,
          NotClassified = 2
      }
  }
  </code></pre>
  
  <p>All the other types shall just be appended to the end of the file. I tried Resharper, but its header file options can only contain static text (I tried <code>Filename: $FILENAME$</code>) and the template option only applies to the newly created classes.</p>
  
  <p>Folks, this is a study project, where I have to provide the source code along with a thesis.</p>