Wix如何隐藏功能选项(无子功能)

时间:2015-01-22 07:15:11

标签: wix windows-installer wix3.9

有一个类似的问题

Edit context menu (selectiontree) in customize dialog?

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

"您无法从选项中删除整个功能将安装在本地硬盘上。仅当存在子功能并且能够安装子功能以及功能本身时才显示它,而将安装在本地硬盘上,它仅安装所选功能且不影响子功能。 #34;

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

以下是代码:

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

2 个答案:

答案 0 :(得分:1)

即使没有子功能,Windows Installer 总是显示整个功能将安装在本地硬盘上项目。至少这个项目出现在我测试的所有没有可见子功能的情况下。它还可能取决于Windows Installer的版本,我在Windows 7中测试了所有最新更新。

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

答案 1 :(得分:0)

您需要添加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>

添加<UIRef Id="WixUI_Mondo"></UIRef>,同时添加对WixUIExtension.dll的引用

每个功能都有**Level**属性,level = 1意味着将安装该功能,如果您将级别更改为1000,例如用户可以在自定义对话框中选择他想要安装此功能的天气< / p>