开发者

Conditionally install feature not working in Wix

开发者 https://www.devze.com 2023-01-03 19:52 出处:网络
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:

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?


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 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


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.


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 behavior...

Anyway, if the your way works...

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号