微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

WiX 安装未选择的功能

如何解决WiX 安装未选择的功能

我正在使用 WiX 创建具有多种功能的安装包。它使用 Mondo UI 允许用户选择一项或多项功能进行安装。我遇到的问题是它总是安装所有功能,而不管用户选择什么。

以下是我的 WXS 文件

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
  <Product Id="*" Name="Setup Test 1" Language="1033" Version="1.0.0.0" Manufacturer="dbush" UpgradeCode="MYGUID="yes" InstallScope="perMachine" Comments="testing the installer" />

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

    <Feature Id="all" Title="all features" Description="everything" Level="1" display="expand">
      <Feature Id="file1" Title="file1" Description="file1.txt" Level="1">
        <ComponentGroupRef Id="file1" />
      </Feature>
      <Feature Id="file2" Title="file2" Description="file2.txt" Level="10">
        <ComponentGroupRef Id="file2" />
      </Feature>
      <Feature Id="regkey" Title="registry key" Description="registry properties to install" Level="11">
        <ComponentGroupRef Id="regkey" />
      </Feature>
    </Feature>
    <Property Id="PROP1" Value="replacement" />
    <UIRef Id="WixUI_Mondo" />
    <UIRef Id="WixUI_ErrorProgresstext" />
  </Product>

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

    <Fragment>
        <ComponentGroup Id="file1" Directory="INSTALLFOLDER">
      <Component Id="file1.txt" Guid="MYGUID">
        <File Id="file1.txt" Source="src/file1.txt" />
      </Component>
    </ComponentGroup>
    <ComponentGroup Id="file2" Directory="INSTALLFOLDER">
      <Component Id="file2.txt" Guid="MYGUID">
        <File Id="file2.txt" Source="src/test2.txt" />
      </Component>
    </ComponentGroup>
    <ComponentGroup Id="regkey" Directory="INSTALLFOLDER">
      <Component Id="reg_key_1">
        <RegistryValue Root='HKCU' Key='SOFTWARE\setup_test_1\properties'
                Name='prop1' Value='[PROP1]'
                Type='string' />
      </Component>
    </ComponentGroup>
    </Fragment>
</Wix>

这可能是什么原因造成的?

我使用的是 WiX 工具集 3.11.2 和 Visual Studio 2017。

解决方法

这是由具有 Feature 的主要 Id="all" 元素引起的。将其更改为其他一些字符串,例如 "everything" 允许安装单个功能。

我找不到任何关于为什么具有此名称的 Id 是特殊情况的文档。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。