c# - Could not load assembly exception when using Assembly.LoadFile -
here's scenario:
i have 3 projects: 2 dlls , 1 console application, let's name them foo.dll, bar.dll , console.exe. console.exe loads foo.dll using assembly.loadfile(@"c:\foo.dll"). foo.dll's project has reference bar.dll , makes use of class. console.exe loads foo.dll fine, problem occurs when foo.dll tries use bar.dll's class. "could not load assembly: "bar.dll" blah blah exception.
some points:
- all projects strong named
- would prefer not use gac
- bar.dll in c:\bar.dll
so in same local directory, correct dlls being referenced (via project properties, , i've used reflector make sure assembly versions correct). if install bar.dll gac works expected.
i think has assembly.loadfile call, , making hop second dll, i'm not sure.
thanks time , input.
assembly.loadfile() should ever used in special circumstances. assembly doesn't have loading context, that's why bar.dll cannot found. real use case tooling, programs dump assembly metadata.
use load or loadfrom(). troubleshoot problems fuslogvw.exe
Comments
Post a Comment