visual-studio-2017 - VSIX:有没有比这更好的方法来获取 Visual Studio 活动文档?
问题描述
我正在升级旧的 Visual Studio 工具集以使用新的可扩展性框架。当我使用新模板时,我得到了一组只需要Microsoft.VisualStudio.Shell.15.0和NewtonSoft.Json的干净引用。然后我开始引入我的旧代码。我尝试做的第一件事是获取运行自定义命令的环境。我使用以下代码:
// The VS Package provides services for examining the Visual Studio environment.
InsertModuleHeaderCommand.serviceProvider = package as IServiceProvider;
InsertModuleHeaderCommand.environment = InsertModuleHeaderCommand.serviceProvider.GetService(typeof(DTE)) as DTE2;
Assumes.Present(InsertModuleHeaderCommand.environment);
此时我需要引入envdte和envdte80。然后我收到一条关于清理互操作的消息。这看起来又丑又旧。有没有更好、更新的方法来获取ActiveDocument?
解决方案
推荐阅读
- python - 根据其他列中的值访问和更改 pandas 数据框中的单元格
- python - 在 Eclipse 中修改 .py 文件并重新创建 .exe 文件
- postgresql - 通过其 pq.StringArray 属性查询 GORM 数据库
- python - seaborn 分布图中的随机空格/条
- javascript - 如何使用 ang-jsoneditor(Angular 中的 JSON 编辑器)实现自动完成
- android - Android - 尝试使用 Facebook SDK 登录时出错
- sql - 替换 Access 中的字符
- powershell - 在 powershell BITS 传输中使用 URL 变量
- git - Azure Git 存储库将组添加到安全性
- java - 如何在android中获取屏幕/电话时间?