2007-10-26

WiX v3 and detection of IIS and ASP.NET

First part of the problem is not WiX specific, namely detection of various Windows Components.
The right place to look is in the Windows Registry, and this article even explains where.

Next we need to create a WiX property that seaches a registry value, and create a WiX Condition that verifies that the property has a given value.

An Example that detects .NET 2.0, IIS and ASP.NET 2.0 are installed and configured in Windows.

<Condition Message="This setup requires the .NET Framework 2.0 or higher.">
  <![CDATA[MsiNetAssemblySupport>="2.0.50727"]]>
</Condition>

<Condition Message="This setup requires the IIS windows component is installed.">
  <![CDATA[IIS="#1"]]>
</Condition>

<Condition Message="This setup requires the ASP.NET 2 is configured in IIS.">
  <![CDATA[ASPNET2]]>
</Condition>

<Property Id="IIS">
  <RegistrySearch Id="IISInstalledComponents" Root="HKLM" Key="SOFTWARE\Microsoft\Windows\CurrentVersion\Setup\OC Manager\Subcomponents" Type="raw" Name="iis_common" />
</Property>

<Property Id="ASPNET2">
  <RegistrySearch Id="ASPNET2InstalledComponents" Root="HKLM" Key="SOFTWARE\Microsoft\ASP.NET\2.0.50727.0" Type="raw" Name="Path" />
</Property>

2 comments:

Chris Miller said...

Your post was very helpful. I'm writing a WiX setup for a side project and you had just what I was looking for.

V said...

Nice post, your wix code is very helpfull and saves time on digging the net :)