我如何为禁用它的功能设置条件(而不是隐藏它)?

How can I put a condition on a feature that disables it (instead of hiding it)?

我怎样才能让某个功能依赖于系统依赖项(例如 powershell),但仍然向用户表明此功能在安装程序中可用。

目前功能列表如下(截图): Feature List

我目前的想法是在功能上设置条件:

<Property Id="POWERSHELL_3_INSTALLED">
  <RegistrySearch Id="Powershell3Installed"
                  Root="HKLM"
                  Key="SOFTWARE\Microsoft\PowerShell"
                  Type="raw"
                  Name="Install" />
</Property>

<Feature Id="TestFeature" 
       Title="Test Feature" 
       Description="Test Feature Description. Note: This feature requires Powershell 3 or higher." 
       Level="1" 
       Absent="allow" 
       InstallDefault="local" 
       AllowAdvertise="no">
    <Condition Level="0">
      <![CDATA[(POWERSHELL_3_INSTALLED <> "#1") AND NOT REMOVE]]>
    </Condition>
</Feature>

对于没有安装 powershell 的用户,这确实会隐藏 TestFeature,阻止他们安装它,但这样一来,用户就不知道如果他们安装 powershell 就可以使用这个额外的功能。

有什么实现方法吗?

Windows 安装程序中的 SelectionTree 控件不支持显示禁用的功能。您将不得不重新实现它——例如,使用复选框。