【发布时间】:2016-03-14 11:53:52
【问题描述】:
我想在 Visual Studio 2015 中使用带有 C# 的 DTE 对象来获取对当前解决方案的引用。
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();
}
}
}
但是当我使用它时,我的解决方案对象始终为 NULL。
那么如何在 .net framework 4.6 上使用 C# 在 VS2015 中获取我当前的解决方案对象?
【问题讨论】:
-
我已经按照stackoverflow.com/questions/4724381/…的解决方案,但问题仍然没有解决。
标签: c#