Search This Blog

Could not load file or assembly 'LinqToExcel'

posted on Thursday, May 3, 2012

A while again I stumbled upon a real brain breaker when I got the error below. Generally when you get the error "could not load file or assembly" it means that you are doing something terribly wrong concerning your assemblies :)

"Could not load file or assembly 'LinqToExcel' or one of its dependencies. An attempt was made to load a program with an incorrect format."

Although an error like seems quite common, in the case of LinqToExcel I might be able to narrow it down for you! In my case I had the LinqToExcel DLL version 1.5.2 referenced in my project. The "Copy Local" setting was set to true and it was really added to the bin folder.

My problem was the Platform target, which was set to AnyCPU, while LinqToExcel requires 32-bit mode. The simple solution to this problem is to set the Build Platform Target to x86. The thing is, this had worked before and the only thing that had changed was the pc I was running it on. The first pc was 32-bit, the second pc was 64-bit... hence the trouble.

More information about this issue and how to fix it in IIS:

I spend way too much time on this before the proverbial penny dropped, so I hope I can spare you the time :)

Could be useful, right?

No comments:

Post a Comment