I have an assembly I'm trying to load with reflection and read a Resource string from.
So, I use something like this:
config.Extras="C:\dev\foo.dll";
string dir = Directory.GetCurrentDirectory();
string tmp = Path.GetDirectoryName(config.Extras[0]);
Directory.SetCurrentDirectory(tmp);
var asm = Assembly.LoadFile(config.Extras[0]);
foreach (var item in asm.GetManifestResourceNames())
{
ResourceManager rm = new ResourceManager(item, asm);
string foo=rm.GetString("foo"); //error here
}
However, this throws a FileNotFoundException because it can't find a referenced assembly of foo.dll
. Foo.dll has a dependency on Bar.dll
. It throws the error saying it can't find bar.dll
. The actual location of bar.dll
though is in the same directory as foo.dll
.
So, how do I resolve this error?