Aaron Stebner's WebLog

Thoughts about setup and deployment issues, WiX, XNA, the .NET Framework and Visual Studio

Real world example of a Windows Media Center application setup built with WiX

Real world example of a Windows Media Center application setup built with WiX

  • Comments 9

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:

  1. Install Windows Vista Release Candidate 1
  2. Install Visual Studio 2005 or Visual C# 2005 Express Edition
  3. Install the Windows Media Center SDK for Windows Vista RC1
  4. Create a directory named c:\wix on your Windows Vista RC1 system
  5. 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
  6. 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
  7. 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
  8. 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
  9. Click on the Build menu and choose Rebuild Solution to build the Q binaries
  10. Click on the Windows Start menu, choose All Programs, then Accessories
  11. Right-click on the item named Command Prompt, choose Run as administrator and click Continue to launch an elevated command prompt
  12. Type cd /d c:\wix
  13. 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:

  1. 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
  2. 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
  3. Right-click on the Q project in the Solution Explorer and choose Properties
  4. Select the Build Events tab
  5. Add a new entry to the Post-build event command line text box that says c:\wix\build_q.bat.
  6. Click on the File menu and choose Save All
  7. 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.

 

Page 1 of 1 (9 items)
Leave a Comment
  • Please add 7 and 4 and type the answer here:
  • Post