Wix how to hide feature options (no subfeatures)

落花浮王杯 提交于 2019-12-10 20:12:21

问题


There is a similar question

Edit context menu (selectiontree) in customize dialog?

but the link in the accepted answer states:

"You cannot remove Entire feature will be installed on local hard drive from the options. It is displayed only when there are subfeatures and enables installation of the subfeatures as well as the feature itself as opposed from Will be installed on local hard drive which installs only the selected features and does not affect subfeatures."

However, I have no subfeatures. How to remove the Entire feature... option?

Here's the code below:

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

回答1:


It looks Windows Installer always displays Entire feature will be installed on local hard drive item even if there are no subfeatures. At least this item was present in all the cases that I tested where there were no visible subfeatures. It could also depend on the version of Windows Installer, I tested in Windows 7 with all the latest updates.

I've always thought Windows Installer doesn't display Entire feature will be installed on local hard drive item for a feature which has no subfeatures. Latest tests proved I was wrong.




回答2:


You need to add the UI type in order to have a different UI in the installer.

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

add <UIRef Id="WixUI_Mondo"></UIRef> , also add reference to WixUIExtension.dll

each feature has **Level**attribute, level=1 meaning the feature will be installed, if you change the level for 1000 for example the user can pick in the custom dialog weather he wants to install this feature or not



来源:https://stackoverflow.com/questions/28083142/wix-how-to-hide-feature-options-no-subfeatures

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!