有条件安装功能在 Wix 中不起作用

发布于 2024-09-05 23:55:32 字数 1561 浏览 2 评论 0原文

我有一个需要在 IIS6 和 IIS7 上支持的设置。现在,我使用 IIS6 的内置 IIS 扩展,如下所示:

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

我在功能中尝试了一个条件,如下所示:

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

无论我的条件值是什么,元数据库内容都会被执行,并且我在 IIS7 系统上收到错误。

我也尝试过将条件放入组件中,但这也不起作用。

是我的使用方式有问题吗?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

你如我软肋 2024-09-12 23:55:32

我的问题是 IISVERSION 属性在哪里设置。我不在 WIX 中使用 IIS 架构,但其他扩展的内置属性随其架构一起记录,我在 IIS 架构的文档中没有看到 IISVERSION。我在这里找到了这个参考 WiX 技巧和提示,用于在注册表中搜索 IIS 的版本号(如果按投票数排序,这是第二个提示/提示)。

如果您已经使用该方法来填充属性,那么我会查看检查,您确定 WiX 会从注册表中返回版本号“#6”吗?编辑:主要版本是 DWORD,所以 #6 是正确的。

编辑:
重新阅读问题和“样本”,我还将功能级别设置为 0 和条件,以便在 IISVERION = 6 时激活该功能。更容易将其理解为正面而非负面。

但所说的只是 IISVERSION 正在设置

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

北音执念 2024-09-12 23:55:32

据我所知,标准 WiX 扩展(如 IIsExtension)中的自定义操作与要执行的组件条件相关联。

此外,尚不清楚 IISVERSION 属性从何而来,但 IIsExtension 公开并正确设置了其自己的属性(称为 IISMAJORVERSION 和 IISMINORVERSION)。因此,在您的情况下,IISMAJORVERSION 将参与组件条件。

我的解决方案中有类似的代码:

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

希望这有帮助。

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.

夜还是长夜 2024-09-12 23:55:32

您是否尝试删除 Absent=disallow 属性?文档称,无论可见性如何,这都将强制安装该功能。我知道将级别设置为 0 应该完全禁用该功能,但我想知道 Absent=disallow 是否会覆盖此行为...

无论如何,如果您的方法有效...

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文