C# – Could not load file or assembly ‘Microsoft.Office.Interop.Excel’

.net-assemblycexcelwinforms

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

Best Answer

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.