g123k
g123k

Reputation: 3874

Can't use an external DLL : FileNotFoundException

I have 2 projects. The first one just generates a DLL.

The second one needs the first DLL. But when I call a method from the DLL, I have a FileNotFoundException, with this message :

BDD, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null

I'm sure that the file exists. Where I'm wrong ?

Upvotes: 1

Views: 2455

Answers (3)

Haplo
Haplo

Reputation: 1368

Agree with Kieren (+1). Maybe it is finding your DLL but it requires another dependent DLL that cannot be found. Or is there a signature issue (maybe you are looking for another DLL version, etc...) To turn on fusion Log (you'll have to create a couple fo registry keys): Set LogFailures to 0/1 to disable/enable

BTW, fusion is the DLL that contains the logic to load an assembly (probing for local path and subfolders if specified, looking at the GAC, ...). After running your executable, you'll find a log detailing the issues the CLR has found when loading referenced assemblies (ignore the NativeImage logs, inspect just the Default logs).

Upvotes: 5

Kieren Johnstone
Kieren Johnstone

Reputation: 42013

Could you give the full message - and:

Please bear in mind that the FileNotFoundException could be for a dependency of the referenced DLL, not just the referenced DLL itself.

You might want to turn on assembly-binding log (Fusion log) to see what's going on, if the DLL is indeed present.

Upvotes: 1

selbie
selbie

Reputation: 104589

Short answer: The DLL needs to be in the same directory as the EXE.

Is this the case?

Upvotes: 1

Related Questions