How do I create a ModulesCatalog.xaml file in VS

Topics: Prism v4 - Silverlight 4
Jun 15, 2012 at 12:40 AM

I'm trying to add a Modules Catalog as a file in VS and I don't know how.

I want to use

ModuleCatalog.CreateFromXaml(new Uri("ModulesCatalog.xaml", UriKind.Relative));

in my CreateModuleCatalog() method inside the Bootstrapper class.

I'm using Prism v4 in a Silverlight 4 project.

I don't know how to create this ModulesCatalog.xaml, I tried creating a UserControl and deleting its code behind, I also tried creating an xml file and changing it's extension to xaml.

No matter what I do, I keep getting these error messages when compiling:

"The tag "ModuleCatalog" does not exist in ..." and so on.

 What can I do to create this ModuleCatalog.xaml file in VS?

Jun 15, 2012 at 1:36 PM
Edited Jun 15, 2012 at 1:38 PM


Have you tried, adding a new file to your main project named ModulesCatalog.xaml using the XML file template as you mentioned but making sure its Build Action is set to "Resource". I believe this could be related to your problem.

Also, regarding how to achieve remote module loading, I believe you could find the "Modularity Hands on Lab, Exercise 3" from the Prism Trainig Kit useful, which includes a step-by-step guidance on how to configure modules in code and using a XAML ModulesCatalog. Also, in this same Trainig Kit, but in the MEF Lab you could find another similar example but using MEF.

I hope you find this helpful,

Agustin Adami

Jun 15, 2012 at 1:38 PM

Thank you.


I'll try it.

Jun 15, 2012 at 2:58 PM
Edited Jun 15, 2012 at 3:11 PM

Hi Agustin,

I don't know how to follow along with the hands on lab, execise 3. I open the project and see it all done in VS, but I don't know how they do things, I guess this is not the way a Hands On Lab works, I did one once (on VS) but I don't remember how I used it.

I remember there were some guidance, and it was very pleasant to do...


Nevertheless, I tried to add it as a xml template, then changed its build action to resource, and then added the ModuleCatalog definitions (this is an exercise)

        ModuleType="Patients.Client.Modules.Patients.PatientsModule, Patients.Client.Modules.Patients, Version=" />
            Patients.Client.Modules.MedicalStaff, Version=" />

But the IDE keeps showing the designer window, and trying to interpret those lines mistakenly, throwing some errors, saying that the type Modularity:ModuleCatalog was not found... etc.



Jun 15, 2012 at 4:53 PM


In the folder where you installed the Prism Training Kit mentioned by Agustin you will find a folder named "1-Modularity" which contains the Modularity Hands On Lab. Inside this folder is a Word document named "Modularity-HOL.docx" which contains the step-by-step description for each exercise. If you wish to follow an specific exercise in this lab (like the Exercise 3 mentioned by Agustin) you will also find a folder containing a solution for each exercise. Inside those you should open the solution stored in the "Begin" folder and follow the instructions described in the "Modularity-HOL.docx" document for the corresponding exercise. As far as I know this is how most of Microsoft's hands on lab are structured.

Regarding the code snippet you posted of your module catalog, take into account that the Microsoft.Practices.Composite assembly is a Prism v2 assembly. If you are using Prism v4, you should replace this line of your module catalog:


With the following one (which uses the Prism v4 assembly:)


You can find more information about declaring module catalogs in a XAML file in the following section of Prism's documentation:

I hope you find this useful,

Damian Cherubini

Jun 15, 2012 at 7:15 PM


Thank you Damian.