[Mono-dev] Class built by mono throws FileNotFoundException when run on windows

Edward Ned Harvey (mono) edward.harvey.mono at clevertrove.com
Wed Sep 2 15:32:45 UTC 2015


I like the advice I'm getting from Alex and Robert.

Alex, you said you're using
	Path.Combine(Directory.GetCurrentDirectory(), "foobar.dll")

When I look around, it seems like this might be more reliable?
	Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "foobar.dll")

I'm doing pretty well now, but not done yet - I have a base factory class, in a factory assembly, that returns instances of derivative classes from specific assemblies at runtime. The new question is: My main project only needs to reference the factory assembly, and in fact the derivative assemblies must also reference the factory assembly, because they derive from the factory assembly. So by default, the derivative assemblies dll files don't get copied to the build dir of the main project. I cannot reference the derivative assemblies from the factory assembly, because of circular reference. But I can reference the derivative assemblies from the main project, which seems to have the effect of copying their DLL's to the build dir, as desired.

So is it safe for me to reference the derivative assemblies from the main project, even though the main project doesn't actually use anything from those assemblies? Or is it possible that the JIT compiler or something will someday be aggressive and cause crashing? (I think it's good - just want sanity check).

And is this a reliable way of getting the dll's to the target directory? Or will the compiler/linker/whatever sometimes exclude those dll's from the build process, because they're referenced but never used? (Again, I think it's good - just want sanity check).

Thanks.


More information about the Mono-devel-list mailing list