更新:2007 年 11 月
在 Visual Studio .NET 2002 和 Visual Studio .NET 2003 中,Microsoft.Office.Core 组件中引用了命令栏。在 Visual Studio 2005 中,在作为 Microsoft.VisualStudio.CommandBars.dll 引用的组件中提供了此命令栏功能。除了提供 Microsoft.Office.Core 所提供的所有命令栏功能外,新的 Microsoft.VisualStudio.CommandBars 程序集还提供对某些方法的更新。
这些更新要求对 Visual Studio 2005 中的现有自动化代码进行一些次要的更改。请注意,仅当重新编译外接程序代码或运行使用旧类型的宏时,才需要进行更改。
移除对 Microsoft.Office.Core 和旧版本 EnvDTE 的引用,将其替换为对 EnvDTE 的 8.0 版本和命令栏程序集 Microsoft.VisualStudio.CommandBars 的引用。
更新类型解析代码。例如,将:
Includes Microsoft.Office.Core using Microsoft.Office.Core;
更改为
Microsoft.VisualStudio.CommandBars using Microsoft.VisualStudio.CommandBars;
更新调用 DTE.CommandBars、Command.AddControl、Commands.RemoveCommandBar 或 Commands.AddCommandBar 的任何代码。这些成员具有或返回 IDispatch 或 System.Object,而不是具有或返回 Microsoft.Office.Core 命名空间中的类型,所以必须执行此操作。