次の方法で共有


Prism Quick Start Kit Update

As promised, I have updated the Prism Quick Start Kit and added a WPF quick-start solution and WPF project templates. You can download the latest release here. In the zip you’ll find four project templates (Shell and Module templates for WPF and Silverlight) and two quick-start solutions, one each for WPF and Silverlight.

To install the templates, copy the project template zip files to your Visual Studio C# template folder. On my system the templates go here:

“My Documents\Visual Studio 2008\Templates\ProjectTemplates\Visual C#”

You should also remove the previous Prism templates if you have installed them. Next, register the templates with Visual Studio by running

devenv.exe /installvstemplates

in a Visual Studio command prompt window (as admin).

When you run Visual Studio and create a new project, you should see the four templates show up in the Visual C# node.

image 

Using the Prism project templates should be pretty straightforward. Couple of things to note though:

  • When you create a project with any of these templates you should first of all update the references to point to the Prism assemblies on your system. The quick-start solutions come complete with a Lib folder that contains pre-built Prism binaries so they work out of the box for convenience, but you should try and use the Prism binaries on your system where you can.

  • You will of course need the Silverlight Visual Studio tools to be installed before you can use any of the Silverlight project templates or the quick-start solution. See here for more information on getting started with Silverlight development.

  • The WPF shell project comes complete with a module catalog that looks for modules in the local output folder. If you add a WPF module to your project you will have to copy the output module assembly to the shell’s bin/Debug or bin/Release folder. I use a post-build step on each module project to automatically copy the assemblies over after every build:

    image
    You’ll need to update this with the name of your shell project.  You can achieve the same thing by simply adding project reference to your modules projects and then Visual Studio will copy over the assemblies for you, but since Prism advocates a  loosely-coupled composite architecture this seems like cheating to me :-).

The Silverlight and WPF quick-start solutions are essentially the same – the only difference between the two is that the WPF shell includes a menu-like button that’s hooked up the shell’s Exit command. I also updated the quick-start solutions to include a style that can be applied to ContentControl regions so that a banner containing the region name is displayed. This is just to make it easier for folks to see where each region is located within the shell.

image

The quick-start solutions are meant to provide a skeletal solution on which you can build real application. They are not very interesting as a standalone app, but if you’re curious to see what it looks like you can run the Silverlight version of the quick-start solution here.

Comments

  • Anonymous
    June 16, 2009
    PingBack from http://www.alvinashcraft.com/2009/06/16/dew-dump-june-16-2009/

  • Anonymous
    June 16, 2009
    I had a very scary moment after following the above instructions which appeared to go well until I started Visual Studio 2008 SP1. When I went to "New Project" I got an error message saying no templates could be found and I should consult the event viewer. Despite the message the new project dialogue opened, but with JUST the PRISM templates showing. All the normal Visual Studio templates had completely vanished! Fortunately shutting down Visual Studio and then restarting it brought them all back and the PRISM templates are listed under "My templates" where the others are listed under "Visual Studio Installed Templates". But for a moment there it was pretty scary.

  • Anonymous
    June 16, 2009
    @irascian - Eek! I've had that happen to me too, even when I haven't been installing templates. Not sure what's going on there. Glad it started working again though.

  • Anonymous
    June 18, 2009
    Thank you for submitting this cool story - Trackback from DotNetShoutout

  • Anonymous
    June 26, 2009
    David, When I try to load up the quickstart I get a Unknown build error, 'The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)' Any idea why?

  • Anonymous
    June 30, 2009
    @truedarkside - I presume this is for the Silverlight quick start solution? Did you update the references to the Prism Silverlight assemblies that you built on your system? I have seen this error when WPF and Silverlight assemblies have been mixed up. Hope this helps...