Word 2007 加载项不适用于 Word 2010
我用 C# 为 Word 2007 编写了一个加载项。为了分发该加载项,我使用了 ClickOnce 安装程序。但是,此加载项不适用于 Word 2010。它会在 vsto.log 文件中产生以下错误:
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Office.Interop.Word, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies. The system cannot find the file specified.
File name: 'Microsoft.Office.Interop.Word, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'
at Microsoft.VisualStudio.Tools.Office.Word.Internal.IWordHostItemProviderProxy..ctor(IHostItemProviderExtendedContract hostItemProvider)
at Microsoft.VisualStudio.Tools.Office.Word.Internal.IWordHostItemProviderProxy.GetProxy(IHostItemProviderExtendedContract contract)
at Microsoft.VisualStudio.Tools.Office.Word.Internal.LocalWordServiceProvider.GetService(Type serviceType)
at Microsoft.VisualStudio.Tools.Applications.Internal.LocalServiceProvider.System.IServiceProvider.GetService(Type serviceType)
at Microsoft.VisualStudio.Tools.Office.EntryPointComponentBase.Microsoft.VisualStudio.Tools.Applications.Runtime.IEntryPoint.Initialize(IServiceProvider hostContext)
at Microsoft.VisualStudio.Tools.Applications.AddInAdapter.ExecutePhase(ExecutionPhases executionPhases)
at Microsoft.VisualStudio.Tools.Office.Internal.OfficeAddInAdapterBase.InitializeEntryPointsHelper()
虽然我知道 Microsoft.Office.Interop.Word dll 之间存在版本不匹配,但加载项看起来对于 Word 2010 系统上可用的问题,我不知道如何解决此问题。我做了一些谷歌搜索,但没有发现任何有趣的结果。请帮忙。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我最终成功找到了问题所在。很抱歉没有早点发布相关信息。看来我链接到了错误的库而不是导致此问题的 PIA 库。进行更改后问题得到解决。
I've managed to trace down the problem in the end. Sorry for not posting about it sooner. It seems I was linking to the wrong libraries instead of the PIA ones which caused this problem. The problem was fixed after making the change.
我相信您必须在单击一次安装项目中关闭这些单词程序集的特定版本检查。
I believe you have to turn off the specific Version check for those word assemblies in the click once install project.
首先使用以下代码检查您的系统中是否安装了 PIA(主互操作程序集)
然后从 http://www.microsoft.com/download/en/details.aspx?id=18346。并运行下面的代码
First Check PIA(primary Interop Assembly) is installed in your system using below code
Then download office PIA from http://www.microsoft.com/download/en/details.aspx?id=18346. and run below code