© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
1 reply
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
ExtensionManager.Core
- this is a class library that contains the interfaces for the extension and service manager class.
-
ExtensionManager
ExtensionManager
- this is a CLI project that loads the extension DLL and registers it to a common interface (from
ExtensionManager.Core
ExtensionManager.Core
).
-
SampleExtension
SampleExtension
- this is a class library the implements the extension interfaces in
ExtensionManager.Core
ExtensionManager.Core
and is loaded at runtime.

Inside the
ExtensionManager
ExtensionManager
I attempt to load the
SampleExtension.dll
SampleExtension.dll
and get the type that implements
IServiceExtension
IServiceExtension
from
ExtensionManager.Core
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
ExtensionManager.Core
instead of loading a new one?

I'm fairly new to this sort of thing, so any help is appreciated.
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

✅ `DllImport` on a dll name only known at runtime
C#CC# / help
3y ago
how to load the dll for System.Management.Automation on runtime ?
C#CC# / help
2y ago
C# DLL failed to load
C#CC# / help
2y ago
❔ compile at runtime
C#CC# / help
3y ago