【问题标题】:Wix how to hide feature options (no subfeatures)Wix 如何隐藏功能选项(无子功能)
【发布时间】:2015-01-22 07:15:11
【问题描述】:

有一个类似的问题

Edit context menu (selectiontree) in customize dialog?

但已接受答案中的链接指出:

“您不能从选项中删除整个功能将安装在本地硬盘上。它仅在有子功能时显示,并启用子功能以及功能本身的安装,而不是将安装在本地硬盘上,它只安装选定的功能,不影响子功能。”

但是,我没有子功能。如何删除 整个功能... 选项?

下面是代码:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
   <Product Id="*" Name="WixTestFeatureTree" Language="1033" Version="1.0.0.0" Manufacturer="TestManufacturer" UpgradeCode="bb04a635-6251-4fd5-8d2f-182d3441dc0a">
      <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />

      <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
      <MediaTemplate />

      <UIRef Id="WixUI_FeatureTree" />
      <UIRef Id="WixUI_ErrorProgressText" />

      <Feature Id="ExeFeature" Title="The EXE file" Level="1">
         <Component Id="TheApp" Guid="*" Directory="INSTALLFOLDER">
            <File Id="TestExe" Source="Test.exe" Vital="yes"></File>
         </Component>
      </Feature>

      <Feature Id="PdfFeature" Title="The PDF file" Level="1">
         <Component Id="ThePDF" Guid="*" Directory="INSTALLFOLDER">
            <File Id="TestPDF" Source="Test.pdf" Vital="yes"></File>
         </Component>
      </Feature>
   </Product>

   <Fragment>
      <Directory Id="TARGETDIR" Name="SourceDir">
         <Directory Id="ProgramFilesFolder">
            <Directory Id="INSTALLFOLDER" Name="WixTestFeatureTree" />
         </Directory>
      </Directory>
   </Fragment>
</Wix>

【问题讨论】:

标签: wix windows-installer wix3.9


【解决方案1】:

看起来 Windows Installer 总是显示整个功能将安装在本地硬盘上项,即使没有子功能也是如此。至少在我测试的所有没有可见子特征的情况下,该项目都存在。它还可能取决于 Windows Installer 的版本,我在 Windows 7 中使用所有最新更新进行了测试。

我一直认为 Windows Installer 不会显示 整个功能将安装在本地硬盘上 项,以表示没有子功能的功能。最新的测试证明我错了。

【讨论】:

    【解决方案2】:

    您需要添加 UI 类型才能在安装程序中拥有不同的 UI。

    <?xml version="1.0" encoding="UTF-8"?>
    <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
       <Product Id="*" Name="WixTestFeatureTree" Language="1033" Version="1.0.0.0" Manufacturer="TestManufacturer" UpgradeCode="bb04a635-6251-4fd5-8d2f-182d3441dc0a">
          <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
    
          <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
          <MediaTemplate />
    
          <UI Id="MyWixUI_FeatureTree">
             <UIRef Id="WixUI_FeatureTree" />
          </UI>
          <UIRef Id="WixUI_ErrorProgressText" />
    
          <Feature Id="ExeFeature" Title="The EXE file" Level="1">
             <Component Id="TheApp" Guid="*" Directory="INSTALLFOLDER">
                <File Id="TestExe" Source="Test.exe" Vital="yes"></File>
             </Component>
          </Feature>
    
          <Feature Id="PdfFeature" Title="The PDF file" Level="1">
             <Component Id="ThePDF" Guid="*" Directory="INSTALLFOLDER">
                <File Id="TestPDF" Source="Test.pdf" Vital="yes"></File>
             </Component>
          </Feature>
        <UIRef Id="WixUI_Mondo"></UIRef>
       </Product>
    
       <Fragment>
          <Directory Id="TARGETDIR" Name="SourceDir">
             <Directory Id="ProgramFilesFolder">
                <Directory Id="INSTALLFOLDER" Name="WixTestFeatureTree" />
             </Directory>
          </Directory>
       </Fragment>
    </Wix>
    

    添加 &lt;UIRef Id="WixUI_Mondo"&gt;&lt;/UIRef&gt; ,同时添加对 WixUIExtension.dll 的引用

    每个功能都有**Level**attribute,level=1 表示将安装该功能,如果您将级别更改为 1000,例如用户可以在自定义对话框中选择他想安装或不安装此功能的天气

    【讨论】:

    • 我已经引用了 WixUIExtension.dll。为 WixUI_Mondo 和 WixUI_FeatureTree 添加 UIRef 只会引发很多重复符号错误。我需要 WixUI_FeatureTree 而不是 WixUI_Mondo。
    猜你喜欢
    • 2012-10-07
    • 2012-09-23
    • 1970-01-01
    • 2020-06-01
    • 1970-01-01
    • 2010-09-17
    • 2010-09-13
    • 2010-09-23
    • 1970-01-01
    相关资源
    最近更新 更多