Convert wpf application to DLL

Jul 18, 2013 at 12:49 PM
Hi all,

I have a wpf windows application with PRISM framework. I need to convert this application in to dll for using in some other application.

Following is the project structure (modules)
  1. Customer
  2. Address
and one shell project.

For converting i tried the following
  1. Removed the app.xaml class
  2. Changed the project propery to class library
  3. Build the application and build was successful and got the dll.
  4. Added this dll in to another wpf application and called the constructor method of one class in main application (it calls the bootstrapper)
but while running this none of the modules constructors are getting called.

Can any one tell me how to convert wpf application to DLL and how to use this dll in some sample application.

Regards,
Nidheesh
Developer
Jul 18, 2013 at 6:09 PM
Hi Nidheesh,

I did a quick test using the Hello World QuickStart and it seems it's possible to start a Prism application from another WPF application. Perhaps the problem is that your Prism application cannot locate the modules when executed from the host application.
What method are you using to load the modules? (direct reference, directory module catalog, etc.)
Also what container are you using in your Prism application?

Regards,

Damian Cherubini
http://blogs.southworks.net/dcherubini
Jul 28, 2014 at 11:10 PM
I realize this thread is old but I'm trying to do the same thing. I have a WPF/Prism EXE that I converted to a DLL that I need to start from a Class Library. I created an entry point that calls the bootstrapper and the shell window appears but fails when I try to inject a view into a region as the RegionManager doesn't recognize the region names. (The EXE I started with works as expected so it's setup as a valid Prism application). I did verify that ConfigureAggregateCatalog is being called and my MEF exports are being picked up so it's not an issue there.

I tried the same thing with the Hello World Quickstart and the shell opens but the module isn't loaded into the region.

Here is my code from InitializeShell in the bootstrapper:
        base.InitializeShell();

        Window mainWindow = (Window)CreateShell();
        mainWindow.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate()
            {
                mainWindow.Show();
            }
        ));
        System.Windows.Threading.Dispatcher.Run();   
Any ideas?

Thanks,
-Scott