Correct way to set up WPF Prism config file to load/register modules?

This is a question I've posted on StackOverflow; hoping to get some additional exposure here.


I'm having issues loading/registering modules using a config file (App.config) in a test WPF Prism project of mine. The project builds and compiles just fine, and there are no errors that get thrown. The problem is that the modules never run Initialize() when I try registering them with a config file, though it runs perfectly fine if I register them in code. This leads me to believe that something in my config file isn't set up correctly, but I don't have much experience with Prism and was hoping someone who did might be able to take a quick look at what I have.

The key piece I'm concerned about is whether I have the assemblyFile and moduleType correct. We'll pretend that the name of the solution is SolutionName, the name of the module project is ProjectName, and the name of the specific module class within the project is ModuleName. So the parenting in the Solution explorer is: SolutionName > ProjectName > ModuleName, without any folders.

Thank you in advance!

<?xml version="1.0" encoding="utf-8" ?> <configuration> <configSections> <section name="modules" type="Microsoft.Practices.Prism.Modularity.ModulesConfigurationSection, Microsoft.Practices.Prism"/> </configSections> <modules> <module assemblyFile="SolutionName.ProjectName.ModuleName.dll" moduleType="SolutionName.ProjectName.ModuleName, SolutionName.ProjectName.ModuleNamee, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" moduleName="ModuleName" startupLoaded="true" /> </modules> <startup> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /> </startup> </configuration> 

by Vartib via /r/csharp

Leave a Reply