Under what conditions can I swap out an assembly that's statically referenced at compile time with a different one for use at runtime? For example:
App Assembly:
- References Common Assembly
- References
ServiceProviderFactory
in Service Assembly
Common Assembly:
- Defines
IServiceProvider
Service Assembly:
- Provides
ServiceProviderFactory
(a factory forIServiceProvider
s) - References Common Assembly
Given the above, I'd like to be able to swap out the Service assembly at install time but I don't know under what conditions the new Service assembly will continue to load.
I believe the following must hold:
- Same assembly name,
- Weakly named assembly or same version number in a strongly named assembly, and
ServiceProviderFactory
signature remains constant.
Note: it seems better to use reflection and search the service assembly for an implementation of IServiceProvider
than to rely on some ServiceProviderFactory
with a fixed signature being present but I'm still interested in the answer to the above.