Real world example of a Windows Media Center application setup built with WiX
I have previously posted an article and a follow-up blog post describing how to use WiX to build MSI packages for Windows Media Center applications. I decided it would also be helpful to show a more concrete example of a setup package for a real Windows Media Center application, so I created a WiX source (WXS) file and a build script that can be used to create an installer for the Q Media Center Podcast and Videoblog Client sample application that ships as part of the Windows Media Center SDK for Windows Vista.
I have posted a ZIP file at this location that contains the WXS file, a set of setup UI strings and a build script batch file that can be used to build an installer for the Q sample application. The WXS file for Q (also available separately at this location) is fully annotated to describe what each part of the MSI is designed to do, and I encourage you to read those comments to get a better sense of how this installer functions behind the scenes.
You can use the following steps to build an installer for the Q sample application on your own system using the setup files that I created:
- Install Windows Vista Release Candidate 1
- Install Visual Studio 2005 or Visual C# 2005 Express Edition
- Install the Windows Media Center SDK for Windows Vista RC1
- Create a directory named c:\wix on your Windows Vista RC1 system
- Download the latest WiX version 2.0 binaries ZIP file from this location and extract the contents to c:\wix on your Windows Vista RC1 system
- Download the WXS file and build script that I created from this location and extract the contents to c:\wix on your Windows Vista RC1 system
- Right-click on the shortcut for Visual Studio 2005 or Visual C# 2005 Express Edition, choose Run as administrator and click Continue to launch Visual Studio with elevated privileges
- Open the Q project - it will be installed to %programfiles%\Microsoft SDKs\Windows Media Center\v5.0\Samples\Windows Media Center Presentation Layer Samples\Q if you installed the Windows Media Center SDK to the default location
- Click on the Build menu and choose Rebuild Solution to build the Q binaries
- Click on the Windows Start menu, choose All Programs, then Accessories
- Right-click on the item named Command Prompt, choose Run as administrator and click Continue to launch an elevated command prompt
- Type cd /d c:\wix
- Type build_q.bat to build the installer for the Q sample application. It will create an MSI named Q_Podcast_Client.msi at %programfiles%\Microsoft SDKs\Windows Media Center\v5.0\Samples\Windows Media Center Presentation Layer Samples\Q\bin\release by default.
Now you can run Q_Podcast_Client.msi to install the application on a Windows Vista Home Premium or Ultimate system.
There are a couple of important notes to keep in mind when using these sample setup files:
- This is very important - do NOT change the component GUIDs of any of the Q components in q.wxs, and do NOT copy and paste these GUIDs into any other WXS files. If you do so, you will end up violating the Windows Installer component rules, which causes problems for installing and uninstalling products. Additional information about the component rules can be found in this blog post by Rob Mensching (which is highly recommended reading if you are building MSI packages).
- The build_q.bat script requires that you have already built the Q binaries (Q.dll and Interop.Microsoft.Feeds.Interop.dll)
- The build_q.bat script assumes that you have installed the Windows Media Center SDK to the default location. You will need to open that batch file in a text editor such as notepad and update the Q_SRC_PATH variable if you installed to a non-default path or installed on a 64-bit OS.
- The build_q.bat script uses the release build of the Q binaries by default. If you run build_q.bat debug, it will use the debug binaries instead
There is also an advanced technique you can use in the Visual Studio IDE to automatically build the MSI each time you recompile the Q binaries. You can use the following steps to configure a post-build event in the Q project that will run build_q.bat each time you compile the project:
- Right-click on the shortcut for Visual Studio 2005 or Visual C# 2005 Express Edition, choose Run as administrator and click Continue to launch Visual Studio with elevated privileges
- Open the Q project - it will be installed to %programfiles%\Microsoft SDKs\Windows Media Center\v5.0\Samples\Windows Media Center Presentation Layer Samples\Q if you installed the Windows Media Center SDK to the default location
- Right-click on the Q project in the Solution Explorer and choose Properties
- Select the Build Events tab
- Add a new entry to the Post-build event command line text box that says c:\wix\build_q.bat.
- Click on the File menu and choose Save All
- Click on the Build menu and choose Rebuild Solution
After adding build_q.bat as a post-build event and rebuilding the project in the Visual Studio IDE, you will see Q_Podcast_Client.msi created in %programfiles%\Microsoft SDKs\Windows Media Center\v5.0\Samples\Windows Media Center Presentation Layer Samples\Q\bin\release on your system.
Hopefully you will find this real world example useful as you work on creating and deploying Windows Media Center applications for Windows Vista. As always, please let me know if you have any questions or run into trouble getting the above steps to work correctly on your system.
Comments
Anonymous
September 18, 2006
PingBack from http://www.xpmediacentre.com.au/community/mce-applications-development-support/12692-i-want-make-plugin.html#post96362Anonymous
September 21, 2006
A couple of folks on the Windows Media Center team tried out the Veronica's Radio sample that Charlie...Anonymous
September 25, 2006
Niall Ginsbourg from Mobilewares (the same person who created the Flickr photo browser XBAP application...Anonymous
November 19, 2006
The Windows Media Center SDK for Windows Vista was released yesterday. One of the changes that was madeAnonymous
December 10, 2006
I previously posted an example of how to use WiX to build an MSI-based installer for a Windows MediaAnonymous
January 27, 2007
Question: I have written a Windows Media Center application, and now I want to create an MSI-based installerAnonymous
April 09, 2007
Recently, I was helping a friend test an installer for a Windows Vista Media Center application and ranAnonymous
April 30, 2007
I haven't been keeping up with the Media Center Sandbox forums as well as I would like to lately, andAnonymous
July 24, 2008
Recently, I noticed this post on the Big Screen Blog where Niall Ginsbourg talks about some changes he