无法加载程序集。 。 Interop.Word 14.0.0.0版本 [英] Could not load assembly . . Interop.Word Version 14.0.0.0

查看:743
本文介绍了无法加载程序集。 。 Interop.Word 14.0.0.0版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经写在Word其中自动生成的字母C#WinForms应用程序。该应用程序工作正常使用Office 2010安装,但不能与安装了Office 2007的这些机器有客户机的时候,而不是我得到以下错误消息 -

I have a WinForms application written in C# which auto generates letters in Word. The application works fine with client machines that have Office 2010 installed, but not with those machines with Office 2007 installed, when instead I get the following error message -

could not load file or assembly 'Microsoft.Office.Interop.Word version=14.0.0

我怀疑我需要添加一个引用到旧版本Interop.Word如的版本= 12,但在可被通过Visual Studio中引用的列表中没有这样的选择。

I suspect I need to Add a Reference to an older version of Interop.Word e.g. version=12, but there is no such option in the list of references available to be via Visual Studio.

我是对的需要一个较旧的参考,如果是这样何处我找到这个?

Am I right about needing an older reference and if so where can I locate this?

或者,如果有别的东西,我需要考虑请告知。

Or if there is something else I need to consider please advise.

推荐答案

请注意了.NET Framework 4.0具有嵌入式主互操作程序集(PIA)的支持。
你可以通过嵌入互操作类型设置为真时,参考的Microsoft.Office.Interop.Word启用它

见的 http://msdn.microsoft.com/en-us/library/dd997297(v = VS.100)的.aspx < 。/ A>有关这方面的信息。

Note that .NET framework 4.0 has support for embedded Primary Interop Assemblies (PIA). You can enable it on the Microsoft.Office.Interop.Word reference by setting the 'Embed Interop Types' to 'True'.
See http://msdn.microsoft.com/en-us/library/dd997297(v=vs.100).aspx for more information about this.

要支持多个Office版本的另一种方法是使用一个库是这样的:
http://netoffice.codeplex.com/

库通过COM互操作使用后期绑定调用,并且不要求使用的主互操作程序集都没有。

Another way to support multiple Office versions is to use a library like this: http://netoffice.codeplex.com/
The library uses late-binding calls via COM interop and does not require the use of the Primary Interop Assemblies at all.

这篇关于无法加载程序集。 。 Interop.Word 14.0.0.0版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆