Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何在 VS 包项目中获取 DTE 实例?它在插件项目中是直截了当的,因为application它作为参数传递给onConnection方法,但不清楚如何在包中获取它。
application
onConnection
从您的主包类:
EnvDTE80.DTE2 dte = this.GetService(typeof(Microsoft.VisualStudio.Shell.Interop.SDTE)) as EnvDTE80.DTE2;
如果 shell 未完全初始化,您可以获得一个获取 SDTE 服务的空实例。在此代码示例中查看如何处理它:
HOWTO:从包中获取 EnvDTE.DTE 实例