Could not load file or assembly 'Microsoft.Office.Interop.Excel'

隐身守侯 提交于 2019-12-07 20:14:57

问题


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


回答1:


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.




回答2:


Check the Path statement on the computer that fails to load the assembly, I will bet that it is different than on the other computers.

This error is telling you that the DLL is not in the path.

For details on how Windows searches for DLLs see: Dynamic-Link Library Search Order



来源:https://stackoverflow.com/questions/8575928/could-not-load-file-or-assembly-microsoft-office-interop-excel

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!