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.
Recently, I noticed this post on the Big Screen Blog where Niall Ginsbourg talks about some changes he made to the installers for his Big Screen applications for Windows Vista Media Center. He didn't go into much detail about what he changed, so I want to explain the OS version detection that happens in the WiX v3.0-based installer files included with the Windows Media Center application project templates that ship in the Windows Media Center SDK v5.3 and that I have previously posted on my blog (for example, here and here). I will also outline the types of changes you may want to make in the OS version conditions in your Windows Media Center application installers depending on what scenarios you plan to support in the future.
For the WiX syntax quoted in this blog post, I will refer to the WiX v3.0 setup files that are created by the Visual Studio project templates that ship in the Windows Media Center SDK. You can find these setup files in the Setup sub-folder after creating an instance of one of the Windows Media Center project templates after installing Visual Studio and the Windows Media Center SDK v5.3.
Description of the OS install block in existing Media Center application setup samples
The WiX source file in the Windows Media Center project templates (named Setup.wxs) includes a custom action to block installation if the user attempts to run the MSI on an unsupported OS. The custom action is defined by the following WiX element:
<CustomAction Id="CA_ErrWrongWindowsVersion" Error="!(loc.LaunchCondition_WrongOSVersion)" />
Later on in Setup.wxs, the conditions are defined that control when this custom action will be run. The following WiX element is included in both the InstallExecuteSequence table and the InstallUiSequence table in order to make sure that the custom action will run if the MSI is installed in full UI mode or in silent mode:
<Custom Action="CA_ErrWrongWindowsVersion" Before="CostInitialize"><![CDATA[(NOT VersionNT = 600 OR NOT MCEINSTALLVERSION = "5.0" OR NOT REGISTERMCEAPP) AND NOT Installed]]></Custom>
There are 4 specific conditions that are checked for this custom action:
Of the conditions listed above, the VersionNT condition (item 1) and the MCEINSTALLVERSION condition (item 2) are not future-proof. In other words, they will end up causing setup to block on future versions of Windows and Windows Media Center if they end up being configured to use higher values for the VersionNT property and/or the Ident registry value.
When we shipped these example installers in the Media Center SDK, we made a conscious decision to bind the installers to a specific, known version of Windows and Windows Media Center. This is because the known version is the only one that can currently be tested and assured of working correctly with Media Center application code developed using the SDK.
Making the install conditions less restrictive
In your scenario (and in the scenario Niall described in his blog post), you may find these conditions too restrictive and may want to update your Media Center application installer so that you do not necessarily have to release new versions of your installers if new versions of Windows and/or Windows Media Center ship with higher values for the VersionNT property and/or the Ident registry value in the future.
If you would like to loosen the restrictions in your installer, I suggest changing the custom action condition to the following:
<Custom Action="CA_ErrWrongWindowsVersion" Before="CostInitialize"><![CDATA[(NOT VersionNT >= 600 OR NOT MCEINSTALLVERSION OR NOT REGISTERMCEAPP) AND NOT Installed]]></Custom>
This condition contains the following changes when compared to the original Setup.wxs file that is created by the project templates in the Windows Media Center SDK:
Note that you must make sure to change this condition in both the InstallExecuteSequence table and the InstallUiSequence table in your WXS file or else you will see different install blocking behavior in full UI mode versus silent mode.
A real-world example - PowerPlaylist
You can take a look at the WiX source code for the PowerPlaylist application on Codeplex for an example of less restrictive installation conditions. The installer for PowerPlaylist was initially created from a Windows Media Center project template in the SDK, and it was later modified to contain less restrictive OS installation conditions. PowerPlaylist is used within the Media Center team at Microsoft as an application compatibility test case, so it had to be modified to allow installation on any possible version of Windows Media Center starting with Windows Vista. There are trade-offs related to application compatibilty that you have to make if you decide to make the OS installation conditions in your Media Center application installer less restrictive though - see the note at the end of this blog post for more details.
Note that unlike the recommendation above, the installer for PowerPlaylist does not check for the Ident registry value at all (you will not see any reference to the MCEINSTALLVERSION property in that installer). This option will also work, but I recommend checking that the Ident value exists is an extra safeguard to make sure that the system really does contain Windows Media Center. A system should not be able to contain Windows Media Center functionality without the Ident registry value also being present.
A word of caution about less restrictive installation conditions
If you decide to update the installer for your Media Center application to include less restrictive OS install conditions, please note that this will allow your application to install on any possible future version of Windows and/or Windows Media Center. Since these future versions do not yet exist, it is impossible to know whether or not your application will continue to be compatible with them. Microsoft generally makes a best effort to maintain application compatibility as it releases new versions of Windows, but compatibility cannot be guaranteed. It is strongly advised that you perform compatibility testing for your application as new versions of Windows are released in order to be sure that things still work as expected within your application. By loosening OS install conditions, you are essentially putting some of the compatibility testing burden onto users of your application, which can be frustrating for them.
I realize that most Media Center application developers are not WiX or Windows Installer experts, so the above information might be confusing. Please don't hesitate to leave a comment on this blog post or contact me if you have more detailed questions about the scenarios described here or would like an opinion about installation behavior that you are considering for your application.
PingBack from http://www.wegotserved.co.uk/2008/11/30/add-in-update-recorded-tv-manager-vista-media-center-add-in-beta-2/