moduleCatalog.XAML loading for a desktop app.

Topics: Prism v4 - WPF 4
Mar 17, 2011 at 3:48 PM

Hi there,

We are using a moduleCatalog and it is working just fine but the problem is, in order to have it work we need to set the properties on the file like so

(from the .csproj file)

<Resource Include="ModuleCatalog.xaml">

Basically what this means is that the "Build Action" is set to "resource", I want to set it to "content" so that it will get copied to the output directory and we can edit it, removing some modules for certain users. Despite the fact that Copy To Output Directory is set to always it doesn't do it (you can change it to Never and it works just fine).

Here is how I am creating the URI.

return ModuleCatalog.CreateFromXaml(new Uri("/PartsFinder;component/ModuleCatalog.xaml", UriKind.Relative));

I have tried a bunch of options and can't get this to work in such a way that the ModuleCatalog gets copied to the bin dir (and read from there) and we can edit it - anyone got any suggestions?



Mar 17, 2011 at 5:21 PM


The recommended approach in Prism to achieve the requirement of being able to specify the modules in a file that isn't compiled into the application is to use the App.config file.

From the Modularity Chapter of the Prism MSDN documentation (specifically in the Registering Modules Using a Configuration File section):

"In WPF, it is possible to specify the module information in the App.config file. The advantage of this approach is that this file is not compiled into the application. This makes it very easy to add or remove modules at run time without recompiling the application."

I hope you find this helpful.

Guido Leandro Maliandi