Question

Is there a way to get the Enable32BitAppOnWin64 metabase property in WiX for IIS6?

I'm installing a web app and need to run aspnet_regiis.exe on a 64bit machine that has IIS set to 32bit mode. To get the path to the exe, I'm using the following:

<!--<?if $(var.Platform) = x64 ?>-->
    <SetProperty Id="ASPNETREGIIS" Sequence="execute" Before="ConfigureIIs" Value="[NETFRAMEWORK20INSTALLROOTDIR64]aspnet_regiis.exe" />
<!--<?else ?>
    <SetProperty Id="ASPNETREGIIS" Sequence="execute" Before="ConfigureIIs" Value="[NETFRAMEWORK20INSTALLROOTDIR]aspnet_regiis.exe" />
<?endif ?>-->

However, when 32bit mode is enabled, I can't rely on the platform to get the correct path of the exe.

Was it helpful?

Solution

There's no standard way in WiX to do this - you'll need a custom action. It should be immediate CA and it will set a property, which you'll use in your conditions. This is a sample code which does what you need, I guess:

 static bool IsIIS32bit()
 {
   var appPools = new DirectoryEntry("IIS://localhost/w3svc/AppPools");
   int enable32Bit;

   try
   {
     enable32Bit = (int)appPools.InvokeGet("Enable32bitAppOnWin64");
   }
   catch
   {
     enable32Bit = 0;
   }

   return enable32Bit == 1;
 }

Note also, that in your sample you use build-time variables to choose from two SetProperty elements. This will work if you have 2 MSI packages, one for each platform. In this case, each of your MSI package will have correctly set property. The extra requirement you add now (check IIS bitness mode) forces you to move the check to install-time. Hence, you'll have to rework your condition logic somehow.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top