tags:

views:

300

answers:

3

Hi, I have a setup which I need to support on IIS6 and IIS7. For now Im using the built in IIS extensions for IIS6 like so:

            <Component Id="C_IISApplication" Guid="{9099909C-B770-4df2-BE08-E069A718B938}" >                    
                <iis:WebSite Id='TSIWSWebSite' Description='TSWeb' SiteId='*' Directory='INSTALLDIR'>                        
                    <iis:WebAddress Id='tcpAddress' Port='8081' />
                </iis:WebSite>
                <iis:WebAppPool Id="BlahWSApplicationPool" Name="Blah" />
                <iis:WebVirtualDir Id="VirtualDir"
                                   Alias="Blah"
                                   Directory="INSTALLDIR"
                                   WebSite="BlahWSWebSite"
                                   DirProperties="WebVirtualDirProperties">

                    <iis:WebApplication Id="WebApplication"
                                        Name="Blah"
                                        WebAppPool="BlahWSApplicationPool"/>

                </iis:WebVirtualDir>
            </Component>

I have tried a condition in the features like so:

<Feature Title="IIS6" Id="IIS6" Description="IIS6" ConfigurableDirectory="INSTALLDIR" Level="1" Absent="disallow" Display="hidden">
        <ComponentRef Id="C_IISApplication" />
        <Condition Level="0"><![CDATA[IISVERSION <> '#6']]></Condition>
    </Feature>

No matter what the value of my condition, the metabase stuff gets executed and I get an error on IIS7 systems.

I have also tried putting the condition in the component and that didnt work either.

Is there something wrong with my usage?

A: 

My Question to you is where is IISVERSION Property set. I don't use IIS schema in WIX but the built in Properties for other extensions are documented with their schema, I don't see a IISVERSION in the documentation for IIS schema. I found this reference here http://stackoverflow.com/questions/471424/wix-tricks-and-tips to search the registry for the version number of IIS (It is the second hint/tip if sorted by vote count).

IF you are already using that method to populate the property then I would look at the check, are you sure that WiX would return "#6" for a version number from the registry??EDIT: Major version is a DWORD SO #6 is correct.

EDIT: Re-reading the question and the 'sample' I would also set the feature level to 0 and the condition so it would ACTIVATE the feature if IISVERION = 6. It is easier to read as a positive the a negative.

But all that being said is IISVERSION Being set

mangelo
Yes, I checked if IISVERSION is being set by creating a condition message after retrieving the value and it indeed returns either #6 or #7.I also agree with setting Level=1 and condition = #6 as it easier to read...its actually what I had orginally but Ive been trying different combinations trying to get the condition to not install the feature.
Damien
I did some more tests, and removed the Display="hidden" attribute from the feature. I can now see the feature is not visible in the feature dialog on IIS7 machine and visible when on IIS6 machine. so I dont understand why its doing the metabase transaction and cant find IIS machine if the component is not being installed.I would of thought the custom actions in the IIS schema would all be skipped if its corresponding component is not installed.
Damien
A: 

As far as I know, the custom actions from the standard WiX extensions (like IIsExtension) are tied to the component conditions to execute.

Also, it is not clear where the IISVERSION property comes from, but IIsExtension exposes and sets correctly its own properties called IISMAJORVERSION and IISMINORVERSION. So, in your case the IISMAJORVERSION would participate in the component condition.

I have a similar code in my solution:

   <Fragment>
      <PropertyRef Id="IISMAJORVERSION"/>
      <PropertyRef Id="IISMINORVERSION"/>
      ...

      <!-- This component is to be installed on IIS 6. It creates a new site with the name provided by user -->
      <Component DiskId="1" Id="CreateIISSite6" Guid="{GUID}" Directory="WebsiteFolder">
         <Condition>IISMAJORVERSION = "#6" AND CREATE_IIS_SITE</Condition>
         <CreateFolder/>
         <iis:WebSite Id="NewIISSite6" SiteId="[IISSITE_ID]" Description="[IISSITE_NAME]" AutoStart="yes" Directory="WebsiteFolder" WebApplication="IISSiteApplication6" DirProperties="IISRootWebDirProperties">
            <iis:WebAddress Id="NewIISSiteAddress6" Header="[IISSITE_HEADER]" Port="[IISSITE_PORT]" />
         </iis:WebSite>
      </Component>
      ...
   </Fragment>

Hope this helps.

Yan Sklyarenko
Thanks, I ended up working around it by creating a override for the customaction in the execute sequence to not execute CONFIGUREIIS if IISVERSION is not #6.But your way does look better plus I never knew about those Wix extension properties :)
Damien
The InstallExecuteSequence condition you're talking about is an 'all-or-nothing' switch. You might need more flexible solution in future, and you'll have to find other ways.
Yan Sklyarenko
A: 

Did you try removing the Absent=disallow attribute? The docs say this will force the feature to be installed regardless of the visibility. I know setting the level to 0 should disable the feature entirely, but I wonder if Absent=disallow overrides this behaviour...

Anyway, if the your way works...

JohnL