title: Get the reference of the DTE object in Visual C# 2015
body: <p>I want to get a reference to the current solution, using the DTE object with C# in Visual Studio 2015.</p>
  
  <pre><code>using System;
  using EnvDTE;
  using Microsoft.VisualStudio.Shell;
  using Microsoft.VisualStudio.Shell.Interop;
  
  namespace TemplatesExample
  {
      class Program
      {
          static void Main(string[] args)
          {
              IVsSolution solution = Package.GetGlobalService(typeof(DTE)) as IVsSolution;
  
              Console.WriteLine(solution.ToString());
  
              Console.ReadKey();
  
          }
  
      }
  }
  </code></pre>
  
  <p>But when I use this, my solution object is always NULL.</p>
  
  <p>So how do I get to my current solution object in VS2015 using C# on .net framework 4.6?</p>