I want to get a reference to the current solution, using the DTE object with C# in Visual Studio 2015.
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();
}
}
}
But when I use this, my solution object is always NULL.
So how do I get to my current solution object in VS2015 using C# on .net framework 4.6?