How can the ModulePath be set to a folder with subfolders

Topics: Prism v1, Prism v2 - WPF 3.5
Jul 25, 2010 at 6:49 AM
Hi, I have a scenario where each module resides in its own subfolder under the "Modules" folder found in the Shell.exe startup path. This is done because the modules are sort of different applications loaded on user demand similar to "Project -> New -> Application 1". Each module loads some specific dlls that are not common among the modules so they reside in its own folder. However, using a directory module catalog (which is by specificaton) the "Modules" folder is supposed to contain the modules and subfolders are not searched. Is there a way fo instruct PRISM to search subfolders for modules as well? The only solution I can think of is to keep all modules in the "Modules" main folder and to have a subfolder for any module specific dlls and resources but it does not seem very clean solution. Thanks for any help, Tony
Jul 26, 2010 at 5:34 PM

Hi Tony,

This is something not supported by Prism out-of-box. The DirectoryModuleCatelog expects that all the modules assemblies will be stored in the ModulePath indicated, as explained here (see the first step – second bullet).

Additionally, the provided DirectoryModuleCatalog implementation lacks of an extensibility point for modifying that logic. That said, you could extend Prism out-of-the-box implementation by providing your own ModuleCatalog implementation. 

Please let me know if this helps.

Fernando Antivero
http://blogs.southworks.net/fantivero

Jul 27, 2010 at 6:17 AM
Hi Fernando, Thanks for the reply, it is most helpful. I also came to this conclusion after posting the question and tried inheriting the ModuleCatalog class into my own and overriding some virtual methods and it worked ! Thanks and best regards, Tony