Thoughts about setup and deployment issues, WiX, XNA, the .NET Framework and Visual Studio
All postings are provided AS IS
with no warranties, and confer no rights. Additionally, views expressed
herein are my own and not those of my employer, Microsoft.
A few days ago, I wrote a blog post describing how to create an MSI-based installer for a Windows game created with XNA Game Studio 3.0. In that post, I described how to create custom actions in the MSI to check for system-level prerequisites (the .NET Framework and the XNA Framework Redistributable) and block the MSI from installing if they are not installed on the user's system.
Adding a bootstrapper to your game installer
The next thing I want to demonstrate is how to expand on the steps in that blog post to create an installer that will do all of the following:
Visual Studio includes a bootstrapper that can do all of the above, and XNA Game Studio 3.0 includes a prerequisite package for the XNA Framework Redistributable 3.0 that integrates with the Visual Studio bootstrapper. As a result, you can use the Visual Studio 2008 or Visual C# 2008 Express Edition IDE to create an installer for your game for both ClickOnce packages and VS setup/deployment projects, and I have previously posted steps for doing this in this blog post.
If you want to create an installer that uses the Visual Studio bootstrapper along with an MSI built with WiX instead of an MSI build with a VS setup/deployment project, you need to perform a couple of additional steps:
Updated sample that builds an MSI and a bootstrapper
I have posted a sample at http://cid-27e6a35d1a492af7.skydrive.live.com/self.aspx/Blog%7C_Tools/WiX%20Samples/wix%7C_sample%7C_xgs30%7C_game%7C_with%7C_bootstrapper.zip that extends my previous sample so you can use it to create a bootstrapper in addition to an MSI. It includes the following additions/changes from the previous sample:
How to use the updated sample
To try out this updated sample, you can use the following steps:
After doing the above, you can copy setup.exe and wix_sample_xgs30_game.msi from the Setup sub-directory to a server and run setup.exe to install your game and its prerequisites on another computer.
Advanced scenario - building an MSI with WiX by using a .wixproj file
Note - it is also possible to create an MSBuild project file to build an MSI using WiX instead of using a batch file that calls the WiX tools directly. I have included a sample MSBuild project file named wix_sample_xgs30_game.wixproj in the new sample that I have posted. It was created by using the Votive Visual Studio package that is a part of the WiX toolset, and it can be built by invoking msbuild.exe directly or by opening the .wixproj file in Visual Studio 2005 or 2008 standard edition or higher on a system that also has WiX v3.0 installed. Keep in mind that Votive is a Visual Studio add-in package, so it can only be installed for use in Visual Studio standard edition or higher. You cannot use it if you only have Visual C# 2008 Express Edition. You can create and build .wixproj files by hand outside of Visual Studio if you only have an Express Edition installed though.
<update date="3/21/2009"> Fixed broken link to sample installer files. </update>
Hi Bill Packard - The setup.exe bootstrapper is generated automatically by Visual Studio, and VS doesn't offer the ability to view or modify that source code. If you need UI or behavior that you don't get from the setup.exe bootstrapper that is generated for you by VS, you would need to write your own bootstrapper to replace the built-in one that VS generates for you.