大家好,小弟是VSTO初学者,现在想实现一个把OFFICE系列的“另存为”菜单置灰的操作。
按照微软MSDN里的说法,选择WORD2007 ADD IN模板之后,生成的工程,可以编译成功,但是当我“F5”准备试运行的时候,就遇到下面问题:
--------------------------------------
无法访问已释放的对象。
************** 异常文本 **************
System.ObjectDisposedException: 无法访问已释放的对象。
在 Microsoft.Office.Tools.SmartTagCollection.BeginInit()
在 WordAddIn1.ThisAddIn.BeginInitialization() 位置 E:\temp\WordAddIn1\WordAddIn1\ThisAddIn.Designer.vb:行号 128
在 WordAddIn1.ThisAddIn.InitializeDataBindings() 位置 E:\temp\WordAddIn1\WordAddIn1\ThisAddIn.Designer.vb:行号 65
在 Microsoft.VisualStudio.Tools.Office.EntryPointComponentBase.Microsoft.VisualStudio.Tools.Applications.Runtime.IEntryPoint.InitializeDataBindings()
在 Microsoft.VisualStudio.Tools.Applications.AddInAdapter.ExecutePhase(ExecutionPhases executionPhases)
在 Microsoft.VisualStudio.Tools.Office.Internal.OfficeAddInAdapter.InitializeEntryPointsHelper()
************** 已加载的程序集 **************
mscorlib
程序集版本: 2.0.0.0
Win32 版本: 2.0.50727.3074 (QFE.050727-3000)
基本代码: file:///C:/Windows/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
Microsoft.VisualStudio.Tools.Office.Runtime.v9.0
程序集版本: 9.0.0.0
Win32 版本: 9.0.21022.123
基本代码: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.VisualStudio.Tools.Office.Runtime.v9.0/9.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Tools.Office.Runtime.v9.0.dll
----------------------------------------
Microsoft.VisualStudio.Tools.Applications.Hosting.v9.0
程序集版本: 9.0.0.0
Win32 版本: 9.0.21022.123
基本代码: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.VisualStudio.Tools.Applications.Hosting.v9.0/9.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Tools.Applications.Hosting.v9.0.dll
----------------------------------------
System
程序集版本: 2.0.0.0
Win32 版本: 2.0.50727.3053 (netfxsp.050727-3000)
基本代码: file:///C:/Windows/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Configuration
程序集版本: 2.0.0.0
Win32 版本: 2.0.50727.3053 (netfxsp.050727-3000)
基本代码: file:///C:/Windows/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
程序集版本: 2.0.0.0
Win32 版本: 2.0.50727.3074 (QFE.050727-3000)
基本代码: file:///C:/Windows/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.Deployment
程序集版本: 2.0.0.0
Win32 版本: 2.0.50727.3053 (netfxsp.050727-3000)
基本代码: file:///C:/Windows/assembly/GAC_MSIL/System.Deployment/2.0.0.0__b03f5f7f11d50a3a/System.Deployment.dll
----------------------------------------
System.Security
程序集版本: 2.0.0.0
Win32 版本: 2.0.50727.3053 (netfxsp.050727-3000)
基本代码: file:///C:/Windows/assembly/GAC_MSIL/System.Security/2.0.0.0__b03f5f7f11d50a3a/System.Security.dll
----------------------------------------
System.Core
程序集版本: 3.5.0.0
Win32 版本: 3.5.30729.1 built by: SP
基本代码: file:///C:/Windows/assembly/GAC_MSIL/System.Core/3.5.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
System.AddIn
程序集版本: 3.5.0.0
Win32 版本: 3.5.30729.1 built by: SP
基本代码: file:///C:/Windows/assembly/GAC_MSIL/System.AddIn/3.5.0.0__b77a5c561934e089/System.AddIn.dll
----------------------------------------
System.AddIn.Contract
程序集版本: 2.0.0.0
Win32 版本: 3.5.30729.1 built by: SP
基本代码: file:///C:/Windows/assembly/GAC_MSIL/System.AddIn.Contract/2.0.0.0__b03f5f7f11d50a3a/System.AddIn.Contract.dll