Is there any way I could tell Visual Studio to build me a .dll that loads another referenced (managed) library only if it exists but still have it as a reference?
Basically I want to be able to inherit from a class that is inside the external lib and only if it the external class exists I will initialize it.
Longer explanation:
- I've made a game with a modding api (via Assembly.LoadFrom)
- I want mods to be moddable. Lets say i have 2 mods Mod A and Mod B. Mod A offers a static registry for adding additonal functionality. So in Mod B I am currently checking if Mod A is loaded, and if yes, use Mod As static registry to register my addtions.
- The problem is, in order to do so without compilation errors I have to add Mod A as a reference in the Visual Studio project for Mod B - which causes that Mod B fails to load if Mod A is not present. But it should be an optional reference :/
Something like "Lazy Library Referencing" would be perfect - where a lib reference is only loaded once it is actually needed.