使工具窗口在 VS 加载时自动显示
在我的 Visual Studio 可扩展性项目中,我尝试使我的工具窗口在包安装后启动时可见。
dotneteers 描述了一种执行此操作的方法,其中涉及添加将以下行添加到包头(即 MyPackage.VSPackage.cs):
[ProvideToolWindowVisibility(typeof(MyToolWindow), Microsoft.VisualStudio.Shell.Interop.UIContextGuids80.NoSolution)]
不幸的是,这不起作用。看来 Visual Studio 并不关注“NoSolution”工具可见性指令(我可以确认它确实适用于 一些其他枚举项,例如调试,但这不适合我的用例)。
如果没有办法让这个在 VS 加载时自动显示工具窗口,有没有人想出任何替代(即新颖的:))解决方案?
In my Visual Studio extensibility project, I'm attempting to make my tool window visible upon launch after package installation.
The dotneteers describe a way of doing this that involves adding the following line to the package header (i.e. MyPackage.VSPackage.cs):
[ProvideToolWindowVisibility(typeof(MyToolWindow), Microsoft.VisualStudio.Shell.Interop.UIContextGuids80.NoSolution)]
Unfortunately, this doesn't work. It seems that Visual Studio doesn't pay attention to the "NoSolution" tool visibility directive (I can confirm that it does work for some of the other enumeration items, like Debugging, but this doesn't fit my use case).
If there's no way to make this auto-show the tool window on VS load, has anyone come up with any alternate (i.e. novel :)) solutions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
或者,您可以尝试使用 ProvideAutoLoad 打包为自动加载,并在 Initialize() 处尝试创建此工具窗口。使用 Package.FindToolWindow() 方法。
Alternatively, you can try making you package as auto load using ProvideAutoLoad and once at the Initialize() try to create this tool window. Use the Package.FindToolWindow() method.