Office 2003:找不到 Microsoft.Office.Interop.Powerpoint dll
我创建了一个 Windows 应用程序,它使用 Microsoft Office 2003 的 Office.dll 和 PowerPoint dll。在设计时,当我将对这些 dll 的引用添加到我的项目时它引用以下路径:
C:\WINDOWS\ assembly\GAC\Microsoft.Office.Interop.PowerPoint\
该应用程序在开发它的计算机上运行完美,但是当我尝试在其上运行它时其他机器失败。它抛出的异常是:
System.Reflection.TargetInitationException:调用目标已引发异常。 ---> System.IO.FileNotFoundException
我试图在我的测试机器上找到上述路径,但令我惊讶的是,尽管安装了office 2003和2007(2台不同的机器),但那里不存在该文件夹。
有人可以帮我解决这个问题吗?
I have created a windows application which makes use of Office.dll and PowerPoint dlls of Microsoft office 2003. At design time, when I am adding reference to these dlls to my project it refers following path:
C:\WINDOWS\assembly\GAC\Microsoft.Office.Interop.PowerPoint\
The application runs perfect on the machine where it is developed, but when I am trying to run it on other machine it fails. The exception it is throwing is:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.FileNotFoundException
I tried to locate the above path on my test machine, but I am surprised that, though office 2003 and 2007 is installed (2 different machines), this folder is not present over there.
Can anybody help me resolving this issue?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
1.Office 2003 Primary Interop Assemblies (PIA) 可再发行组件是一个 Microsoft Windows Installer 程序包,其中包含 Microsoft Office 2003 产品的 Primary Interop Assemblies,您可以从 此处 它包含您需要的程序集
2.您可以将“设置为 true”在项目引用属性中复制此程序集的“本地”键,在这种情况下,它将被复制到项目的输出文件夹中
3. 您实际上并不需要它来使用 MS Office 应用程序,尽管它使操作变得更容易。下面是一个如何在没有互操作类的情况下打开演示文稿的示例
,没有测试这个确切的类,但是像这样的东西对我来说效果很好,问候
1.There is an Office 2003 Primary Interop Assemblies (PIA) redistributable is a Microsoft Windows Installer package that contains the Primary Interop Assemblies for Microsoft Office 2003 products you can get it from here it includes an assembly you need
2.You can set true to the "Copy Local" key for this assembly in your project references properties, in this case it would be copied into the output folder of your project
3.You don't really need it to work with MS Office applications, though it makes it easier. Below is an example of how you can open a presentation without interop classes
didn't test this exact one, but smth like this works fine for me, regards
您正在寻找的互操作 dll 已安装在 GAC 中的开发计算机上。因此,它不是标准部署的一部分。您需要手动复制它。
另一种选择(可能是更干净的选择)是在目标计算机上运行 Office 安装并让它安装所有必需的内容。只需确保您选择了正确的选项
The interop dll you are looking for is installled on your deevelopment machine in the GAC. As such it is not a part of the standard deployment. You need to copy it over by hand.
Another option (and may be a cleaner one) would be to run the Office installation on the target machine and let it install all what's necessary. Just make sure that you selected proper options