C
C#13mo ago
Arch Leaders

Load DLL at runtime with shared dependency

Hello, I'm currently attempting to make an extension loader for my application, however I'm having issues loading the assembly at runtime because a dependency is already loaded in the running assembly. This is my current setup: - ExtensionManager.Core - this is a class library that contains the interfaces for the extension and service manager class. - ExtensionManager - this is a CLI project that loads the extension DLL and registers it to a common interface (from ExtensionManager.Core). - SampleExtension - this is a class library the implements the extension interfaces in ExtensionManager.Core and is loaded at runtime. Inside the ExtensionManager I attempt to load the SampleExtension.dll and get the type that implements IServiceExtension from ExtensionManager.Core, however doing so throws the following exception:
Unable to load one or more of the requested types.
Method 'RegisterExtension' in type 'SampleExtension.SampleExtension' from assembly 'SampleExtension, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.
Unable to load one or more of the requested types.
Method 'RegisterExtension' in type 'SampleExtension.SampleExtension' from assembly 'SampleExtension, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.
Is there a way to tell the SampleExtension DLL to use the loaded ExtensionManager.Core instead of loading a new one? I'm fairly new to this sort of thing, so any help is appreciated.
1 Reply
Arch Leaders
Arch Leaders13mo ago
Source code is here if it helps: https://github.com/ArchLeaders/ExtensionManager
GitHub
GitHub - ArchLeaders/ExtensionManager: Project to test a runtime-ex...
Project to test a runtime-extension loader. Contribute to ArchLeaders/ExtensionManager development by creating an account on GitHub.