Visual Studio 2010 扩展获取对解决方案资源管理器的引用

发布于 2024-09-09 08:45:40 字数 357 浏览 0 评论 0原文

我正在将我的一个宏移至 VS2010 扩展。我有来自宏的行...

Dim items As EnvDTE.UIHierarchyItems = DTE.ToolWindows.SolutionExplorer.UIHierarchyItems

我已经设法获得 DTE - DTE dte = GetService(typeof(SDTE)) as DTE;

但它确实包含 ToolWindows 属性。

我尝试使用 dte.Windows 获取解决方案资源管理器,并且这种方法有效,但结果没有 UIHierarchyItems。

简而言之,获取解决方案资源管理器参考的最佳方式是什么?

I'm moving one of my macros over to become a VS2010 extension. I have the line from the macro...

Dim items As EnvDTE.UIHierarchyItems = DTE.ToolWindows.SolutionExplorer.UIHierarchyItems

I've managed to get DTE - DTE dte = GetService(typeof(SDTE)) as DTE;

but it does contain a ToolWindows Property.

I tried using dte.Windows to get the solution explorer, and that sort of works, but the result doesn't have a UIHierarchyItems.

So in short, what's the best way to get a reference to the solution explorer?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

你又不是我 2024-09-16 08:45:40

它位于 DTE2 上,这就是为什么你没有找到它。只需将 as DTE 替换为 as DTE2 即可。

It's on DTE2, which is why you didn't find it. Just replace the as DTE with as DTE2.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文