tags:

views:

477

answers:

3

The Wix WebSite action has to be specified outside of a Component if you want to safely use the Default Web Site (by safely I mean the installer won't remove the default site on uninstall).

<Fragment>
    <iis:WebSite Id="DefaultWebSite" Description="Default Web Site" Directory="INSTALLDIR">
        <iis:WebAddress Id="AllUnassigned" Port="80" />
    </iis:WebSite>
</Fragment>

My installer has a bunch of Features, and some are only enabled when IIS is installed. Disabling the features based on Conditions works fine, and no virtual directories or sites are created, but during install MSI still tries to contact IIS due to the WebSite action and fails on a machine without IIS installed:

"Cannot connect to Internet Information Server. (-2137221164      )"

I found something about SKIPCONFIGUREIIS but this doesn't seem to work in Wix 3.

+1  A: 

I managed to solve this in Wix 3 using the Custom Action Conditions support in InstallExecuteSequence. This example assumes the feature "Web" is the only one that requires we perform IIS actions:

<InstallExecuteSequence>
    <!-- Disable ConfigureIIS if we don't need it: -->
    <Custom Action="ConfigureIIs" After="InstallFiles">(&amp;Web = 3)</Custom>
</InstallExecuteSequence>
Simon Steele
Ahh, the infinite mysteries of Wix.
Cheeso
A: 

I just looked and found, in a WIX-generated MSI, the condition NOT SKIPCONFIGUREIIS AND VersionNT > 400 associated to the ConfigureIis row in the InstallExecuteSequence table.

In other words you could also use a Custom action like this:

<InstallExecuteSequence>
  <!-- Disable the ConfigureIIs action if we don't need it: --> 
  <Custom Action="CA.SkipConfigureIIs" 
          After="InstallFiles">NOT &amp;F.IisFeature = 3</Custom>
</InstallExecuteSequence>


<CustomAction Id="CA.SkipConfigureIIs"
              Property="SKIPCONFIGUREIIS"
              Value="1"
              Return="check" />
Cheeso
Thanks, I think the SKIPCONFIGUREIIS bit was for Wix 2?
Simon Steele
It's still in my MSI, and I use 3.0.5419.0.
Cheeso
+2  A: 

This saved me from a lot of grief! Just wanted to add that the above will skip IIS configuration on uninstall regardless of installation state. I.E. if the feature was installed the virtual directory will not be removed from IIS on uninstall.

This seems to work for me:

<InstallExecuteSequence>
    <!-- Disable ConfigureIIS if we don't need it: -->
    <Custom Action="ConfigureIIs" After="InstallFiles"><![CDATA[&Web=3 OR !Web=3]]></Custom>
</InstallExecuteSequence>
Adrian Gee
Thanks Adrian, I guess I need to check my uninstall again!
Simon Steele