VSTO开发插件,无法加载VS2008模板生成的插件……

BonFishbone 2009-12-31 11:18:22
大家好,小弟是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
----------------------------------------
Microsoft.VisualStudio.Tools.Applications.Runtime.v9.0
程序集版本: 9.0.0.0
Win32 版本: 9.0.21022.123
基本代码: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.VisualStudio.Tools.Applications.Runtime.v9.0/9.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Tools.Applications.Runtime.v9.0.dll
----------------------------------------
Microsoft.VisualStudio.Tools.Applications.ServerDocument.v9.0
程序集版本: 9.0.0.0
Win32 版本: 9.0.21022.123
基本代码: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.VisualStudio.Tools.Applications.ServerDocument.v9.0/9.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Tools.Applications.ServerDocument.v9.0.dll
----------------------------------------
System.Windows.Forms
程序集版本: 2.0.0.0
Win32 版本: 2.0.50727.3053 (netfxsp.050727-3000)
基本代码: file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Drawing
程序集版本: 2.0.0.0
Win32 版本: 2.0.50727.3053 (netfxsp.050727-3000)
基本代码: file:///C:/Windows/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
Microsoft.VisualStudio.Tools.Office.Contract.v9.0
程序集版本: 9.0.0.0
Win32 版本: 9.0.21022.123
基本代码: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.VisualStudio.Tools.Office.Contract.v9.0/9.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Tools.Office.Contract.v9.0.dll
----------------------------------------
Microsoft.Office.Tools.v9.0
程序集版本: 9.0.0.0
Win32 版本: 9.0.21022.123
基本代码: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.Office.Tools.v9.0/9.0.0.0__b03f5f7f11d50a3a/Microsoft.Office.Tools.v9.0.dll
----------------------------------------
WordAddIn1
程序集版本: 1.0.0.0
Win32 版本: 1.0.0.0
基本代码: file:///E:/temp/WordAddIn1/WordAddIn1/bin/Debug/WordAddIn1.DLL
----------------------------------------
Microsoft.VisualStudio.Tools.Office.Word.AddInAdapter.v9.0
程序集版本: 9.0.0.0
Win32 版本: 9.0.21022.123
基本代码: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.VisualStudio.Tools.Office.Word.AddInAdapter.v9.0/9.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Tools.Office.Word.AddInAdapter.v9.0.dll
----------------------------------------
Microsoft.Office.Tools.Common.v9.0
程序集版本: 9.0.0.0
Win32 版本: 9.0.30729.1
基本代码: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.Office.Tools.Common.v9.0/9.0.0.0__b03f5f7f11d50a3a/Microsoft.Office.Tools.Common.v9.0.dll
----------------------------------------
Microsoft.VisualStudio.Tools.Office.AddInAdapter.v9.0
程序集版本: 9.0.0.0
Win32 版本: 9.0.21022.123
基本代码: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.VisualStudio.Tools.Office.AddInAdapter.v9.0/9.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Tools.Office.AddInAdapter.v9.0.dll
----------------------------------------
Microsoft.VisualStudio.Tools.Applications.AddInAdapter.v9.0
程序集版本: 9.0.0.0
Win32 版本: 9.0.21022.123
基本代码: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.VisualStudio.Tools.Applications.AddInAdapter.v9.0/9.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Tools.Applications.AddInAdapter.v9.0.dll
----------------------------------------
Microsoft.VisualStudio.Tools.Applications.Contract.v9.0
程序集版本: 9.0.0.0
Win32 版本: 9.0.21022.123
基本代码: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.VisualStudio.Tools.Applications.Contract.v9.0/9.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Tools.Applications.Contract.v9.0.dll
----------------------------------------
Microsoft.VisualStudio.Tools.Applications.Adapter.v9.0
程序集版本: 9.0.0.0
Win32 版本: 9.0.21022.123
基本代码: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.VisualStudio.Tools.Applications.Adapter.v9.0/9.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Tools.Applications.Adapter.v9.0.dll
----------------------------------------
Anonymously Hosted DynamicMethods Assembly
程序集版本: 0.0.0.0
Win32 版本: 2.0.50727.3074 (QFE.050727-3000)
基本代码: file:///C:/Windows/assembly/GAC_32/mscorlib/2.0.0.0__b77a5c561934e089/mscorlib.dll
----------------------------------------
Microsoft.VisualStudio.Tools.Office.Word.HostAdapter.v9.0
程序集版本: 9.0.0.0
Win32 版本: 9.0.21022.123
基本代码: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.VisualStudio.Tools.Office.Word.HostAdapter.v9.0/9.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Tools.Office.Word.HostAdapter.v9.0.dll
----------------------------------------
Microsoft.VisualStudio.Tools.Office.HostAdapter.v9.0
程序集版本: 9.0.0.0
Win32 版本: 9.0.21022.123
基本代码: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.VisualStudio.Tools.Office.HostAdapter.v9.0/9.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Tools.Office.HostAdapter.v9.0.dll
----------------------------------------
Microsoft.VisualStudio.Tools.Office.Word.AddInProxy.v9.0
程序集版本: 9.0.0.0
Win32 版本: 9.0.21022.123
基本代码: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.VisualStudio.Tools.Office.Word.AddInProxy.v9.0/9.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Tools.Office.Word.AddInProxy.v9.0.dll
----------------------------------------
Microsoft.Office.Interop.Word
程序集版本: 12.0.0.0
Win32 版本: 12.0.4518.1014
基本代码: file:///C:/Windows/assembly/GAC/Microsoft.Office.Interop.Word/12.0.0.0__71e9bce111e9429c/Microsoft.Office.Interop.Word.dll
----------------------------------------
office
程序集版本: 12.0.0.0
Win32 版本: 12.0.4518.1014
基本代码: file:///C:/Windows/assembly/GAC/office/12.0.0.0__71e9bce111e9429c/office.dll
----------------------------------------
Microsoft.VisualBasic
程序集版本: 8.0.0.0
Win32 版本: 8.0.50727.3053 (netfxsp.050727-3000)
基本代码: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.VisualBasic/8.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll
----------------------------------------
Microsoft.VisualStudio.Tools.Applications.ServerDocument.v9.0.resources
程序集版本: 9.0.0.0
Win32 版本: 9.0.30729.1
基本代码: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.VisualStudio.Tools.Applications.ServerDocument.v9.0.resources/9.0.0.0_zh-CHS_b03f5f7f11d50a3a/Microsoft.VisualStudio.Tools.Applications.ServerDocument.v9.0.resources.dll
----------------------------------------


有哪位兄弟遇到过相同问题或者知道怎么解决的吗?谢谢啦~
...全文
433 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
上sp1
BonFishbone 2010-01-01
  • 打赏
  • 举报
回复
自己解决了……原来vs2008 sp1要对应vsto3 sp1...把KB949258补丁装上就可以了,呵呵。
BonFishbone 2010-01-01
  • 打赏
  • 举报
回复
补充一下,同样版本的VS2008跟OFFICE2007,我在虚拟机的windows XP中可以加载插件成功

但是我主机的操作系统是VISTA的,不知道跟这个有没有关系。

5,139

社区成员

发帖
与我相关
我的任务
社区描述
其他开发语言 Office开发/ VBA
社区管理员
  • Office开发/ VBA社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧