bobblez
bobblez

Reputation: 1370

Debugging "Could not load file or assembly" that only happens on some computers

So I recently updated my software and with the new version I supply a new dll-file, lets call it My.dll. Now, the old version works just fine on every computer I have tried.

The problems began with the new version. Specifically, so far on at least one computer, it states that "Could not load file or assembly My.dll". This even happens when I have dropped a copy of the software on a network drive and run the software directly from there. It works on every other computer but one, which still gives the exact same error where other computers work fine.

The dll in question is even in the same directory as the executable, so I'm really quite bummed here. I tried to google around a bit as well, but all the issues I found were related to ASP.NET specifically. Any ideas on how to go about finding the problem would be much appreciated.

Upvotes: 2

Views: 2675

Answers (5)

ecoGreen
ecoGreen

Reputation: 126

--Right Click on Project --Goto Properties->Build tab --Change Platform and Platform Target to Any CPU, Save and run

Upvotes: 0

Daniel Rose
Daniel Rose

Reputation: 17638

You could take a look at the error log using the Assembly Binding Log Viewer. First you have to turn on logging.

Upvotes: 0

AntonyW
AntonyW

Reputation: 2414

Use the Assembly binding log viewer and set it to log failures. This will give you some clues as to why it is not loading.

Upvotes: 0

Mr47
Mr47

Reputation: 2655

It is possible that the computer in question has a DLL added to it's Global assembly cache. This would take priority over the DLL in the same folder.
More information about the GAC: http://msdn.microsoft.com/en-us/library/yf1d93sz(v=VS.100).aspx

Upvotes: 2

Paul Alan Taylor
Paul Alan Taylor

Reputation: 10680

Is there an old copy of the DLL lying around? Perhaps with a different name? I had a similar issue when I changed the name of a dll. Internally, the namespaces were the same.

In my case, an older version of the DLL was still there. .NET got confused with two assemblies in the bin directory having the exact same namespaces and classes, couldn't decide on which to load, and threw an exception.

Removing the older version of the dll solved the issue.

Upvotes: 1

Related Questions