无法加载文件或程序集“Microsoft.Office.Interop.Excel” [英] Could not load file or assembly 'Microsoft.Office.Interop.Excel'

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

问题描述

我在WinForm应用程序中使用Excel有问题。
当我在几台计算机上尝试时,它的工作原理很好,但是当我在另一台计算机上尝试时,它会给我System.IO.FileLoadException:无法加载文件或程序集错误。



我在项目中添加了一个引用(Microsoft.Office.Interop.Excel),甚至将Copy Local复制到true。



我不知道为什么会发生这种情况,因为所有电脑都使用相同的办公室版本(Office 2007 = Version 12)。



任何人都有想法?



谢谢,
Udi

解决方案

您可能需要检查.csproj文件中的引用,以确保从bin文件夹而不是其他地方引用该DLL。


I'm having a problem using Excel in my WinForm application. When I try it on several computers it works just fine on them, but when I try it on another computer it gives me the 'System.IO.FileLoadException: Could not load file or assembly' error.

I've added a reference in my project ('Microsoft.Office.Interop.Excel') and even set 'Copy Local' to true.

I don't know why this is happening because all computers use the same office version(Office 2007 = Version 12).

Anyone has an idea?

thanks, Udi

解决方案

You might want to check the reference in the .csproj file to make sure that the DLL is being referenced from the bin folder rather than from somewhere else.

这篇关于无法加载文件或程序集“Microsoft.Office.Interop.Excel”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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