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 little while ago, Bob Arnson posted a description of the WixGamingExtension, which was added to WiX v3.0 to allow setup developers to integrate their game with the Windows Vista Game Explorer. When he created the WixGamingExtension, he also created another smaller extension that he didn't publicize outside of the WiX help documentation (wix.chm).
The other extension is called the WixDirectXExtension, and I want to describe it in more detail here because it contains a couple of system configuration detection custom actions that are typically useful for game developers who are creating MSI-based installers for their games.
Description of the WixDirectXExtension
The WixDirectXExtension has been available in WiX v3.0 since the 3.0.4014.0 build. The WixDirectXExtension contains a custom action named WixQueryDirectXCaps. This custom action queries the DirectX capabilities of the video card on a user's system and then set the following MSI properties:
How to use WixDirectXExtension in your setup authoring
To use the WixDirectXExtension properties in your WiX v3.0-based setup, you can use the following steps:
For example:
<PropertyRef Id="WIX_DIRECTX_PIXELSHADERVERSION" /> <CustomAction Id="CA_CheckPixelShaderVersion" Error="[ProductName] requires pixel shader version 3.0 or greater." /> <InstallExecuteSequence> <Custom Action="CA_CheckPixelShaderVersion" After="WixQueryDirectXCaps"> <![CDATA[WIX_DIRECTX_PIXELSHADERVERSION < 300]]> </Custom> </InstallExecuteSequence> <InstallUISequence> <Custom Action="CA_CheckPixelShaderVersion" After="WixQueryDirectXCaps"> <![CDATA[WIX_DIRECTX_PIXELSHADERVERSION < 300]]> </Custom> </InstallUISequence>
A note about error handling in WixDirectXExtension
Note that the WixDirectXExtension properties are set to the value NotSet by default. The WixDirectXExtension custom action is configured to not fail if it encounters any errors when trying to determine DirectX capabilities. In this type of scenario, the properties will be set to their NotSet default values. In your setup authoring, you can compare the property values to the NotSet value or to a specific value to determine whether WixDirectXExtension was able to query DirectX capabilities and if so, what they are.
What WixDirectXExtension does behind the scenes
If you're interested, the WixQueryDirectXCaps custom action does the following behind the scenes: