Injecting a module with dependencies on a UserControl library

Topics: Prism v4 - WPF 4
Mar 12, 2012 at 12:34 PM


I am using Unity to load in my modules from the App.config. My modules are injecting views via the RegionManager and everything is working well.

My question is, one of my views contains controls which are held in an external assembly. If I modify this assembly to contain an empty class which implementes IModule when I can resolve it as a dependency and everythign works fine. It just seems a little clunky and I worry that I may in future want to use assemblies that I don't have control over.

Am I missing something here? How else can I ensure that the module I resolve is able to recolve its own dependencies?




Mar 12, 2012 at 5:44 PM
Edited Mar 12, 2012 at 5:45 PM


Based on my understanding of your scenario, I believe there is no need to modify the external assembly to resolve it as a module dependency.

In my opinion you could directly reference the external assembly in the module's project that is loaded through the configuration file.

Note that you will have to ensure that the external assembly's dll file is in the same location as the module's dll that is being loaded by the configuration file at run time. A possible way to automatically store the modules' assemblies in a custom folder after a successful build could be by configuring post-build events. You could find an example of this in Modules E and F of the Modularity Quickstart in which their assemblies are copied into the same location as the application executable.

I hope you find this helpful,

Agustin Adami