In the past, I’ve posted examples (such as this and this) demonstrating how to create installers for Windows Vista Media Center applications using WiX. A couple of those examples ended up shipping in the Media Center SDK for the Q and Z sample applications. Recently, I was asked about how to create a WiX-based MSI that would install and register a Media Center application and also add a custom strip to the Media Center start menu for the application. There is not yet an example for the setup authoring for this specific scenario in the Media Center SDK, so I decided to create something and post it here.
In order to create an MSI that modifies the Media Center start menu, it is necessary to have a general understanding of how start menu customizations can be accomplished. The following information is very helpful to understand this:
- The high-level steps needed to add a custom strip to the Media Center start menu and control the ordering of tiles are covered in the Creating Custom Start Menu Strips topic in the Windows Vista Media Center SDK documentation
- The Media Center SDK includes a Register Application sample that is installed to C:\Program Files\Microsoft SDKs\Windows Media Center\v5.0\Samples\Register Application (if you have the SDK installed to the default path). This sample includes RegisterMceApp XML files, image files and registry files needed to register a set of applications and place them on the Media Center start menu.
- I have written a few blog posts about customizing the Media Center start menu that contain some of the same information that is in the SDK as well as some supplemental information for deployment scenarios.
How to create an MSI to add a custom strip to the Media Center start menu
I have created a downloadable example that uses WiX v3.0 and creates a custom strip with 5 tiles on it in the Media Center Start menu.
For this example, I used the Register.Application.1 application that is included in the Windows Vista Media Center SDK at C:\Program Files\Microsoft SDKs\Windows Media Center\v5.0\Samples\Register Application.
Here are the exact steps I used to create this example:
- I started by making copies of the setup files for the Z sample application (located at C:\Program Files\Microsoft SDKs\Windows Media Center\v5.0\Samples\Windows Media Center Presentation Layer Samples\Z\Setup)
- I modified z.wxs by removing all of the files included as a part of the Z sample application, and instead adding the following files that are a part of Register.Application.1 in the Register Application sample:
Note – Register.Application.1 is a Windows Media Center Presentation Layer web application, so it is not necessary to install any binaries for this example. However, if your application is not a web application, you will need to install one or more binary files as part of your application and the main application binary needs to be installed to the GAC. The Q and Z sample applications demonstrate how to do this if needed for your application.
- I added a new component named StartMenuRegistration, and included the set of registry values that is listed in the file Registry.Application.1.reg in the Register Application sample in the Media Center SDK in this new component
- I made a few other miscellaneous changes to the copy of z.wxs so that this new example would have unique product code, upgrade code, product version and install path information
- I modified the build.bat file and WXL file to include information specific to this new sample instead of information for the Z sample that I used as a starting point
How to build and run this example
If you would like to try out this application on your system to see what happens when you install it, you can use the following steps to download the sample and build the MSI:
- Download the latest version of the WiX v3.0 wix3.msi and install it on your system if you haven’t already
- Download and extract the contents of the example that I posted at http://astebner.sts.winisp.net/Tools/start_menu_strip_setup_example.zip to a local folder on your system
- Go to the folder that you extracted start_menu_strip_setup_example.zip into and double-click on the build.bat file to create an MSI for this example using WiX v3.0
- Install the resulting setup.msi from the same folder onto a Windows Vista Home Premium or Ultimate system
- Launch Media Center and look for a strip named Custom Start Menu with tiles named title.start.app.1.1, title.start.app.1.2, title.start.app.1.3, title.start.app.1.4 and title.start.app.1.5
- Re-run setup.msi to uninstall the sample application once you are done trying it out
The above example only demonstrates how to create a custom strip on the Media Center start menu. As you can see by looking at the details of the Register Application sample in the Media Center SDK, there are many other options that can be configured to control where entry points will appear when installing/registering Media Center applications. You will need to adjust the WiX setup authoring shown in this example as appropriate depending on what kind of scenarios you would like to support for your application. Hopefully the example that I posted will provide enough of a starting point to make any further customizations relatively straightforward.
One other very important note – please do not copy and paste the contents of this example and use it as is. Windows Installer uses component GUIDs to uniquely identify resources, so you need to change the component GUID values in the WXS file any time you create a new component in your setup authoring. You can use a tool like guidgen.exe from Visual Studio or http://www.guidgen.com to generate new GUIDs. If you copy and paste the sample, change the names of the files being installed, but do not change the component GUIDs, it will cause install and uninstall problems for products that use the same GUIDs (as described here).