WiX-如何允许用户更改引导程序上的安装位置

WiX-如何允许用户更改引导程序上的安装位置,wix,bootstrapper,wix3.8,Wix,Bootstrapper,Wix3.8,我需要允许用户更改安装位置。我已经试过了这篇文章中给出的解决方案 我需要将我的wix msi文件添加到我的引导程序项目中。 下面是我的msi项目代码 <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" /> <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is alread

我需要允许用户更改安装位置。我已经试过了这篇文章中给出的解决方案

我需要将我的wix msi文件添加到我的引导程序项目中。 下面是我的msi项目代码

    <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />

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

    <Feature Id="ProductFeature" Title="SetupProject1" Level="1">
        <ComponentRef Id="ProductComponent" />
    </Feature>
</Product>

<Fragment>
    <Directory Id="TARGETDIR" Name="SourceDir" src="[TARGETDIR]">
            <Directory Id="INSTALLFOLDER" Name="SetupProject1">
      <Component Id="ProductComponent" Guid="2ACAD378-270B-4B50-AAED-A234A6BB8276">
        <File Name="$(var.WindowsFormsApplication2.TargetFileName)" Source="$(var.WindowsFormsApplication2.TargetPath)" />
      </Component>
    </Directory>
    </Directory>
</Fragment>

<Fragment>
    <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
    </ComponentGroup>
</Fragment>

下面是引导程序代码


您使用的是标准引导程序吗?RtfLicense还是HyperlinkLicense

如果您在Wix标准boostrapper中设置了
suppressOptions ui=“no”
,这将显示一个选项按钮,允许用户手动修改安装位置

<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense">
  <bal:WixStandardBootstrapperApplication
    SuppressOptionsUI="no"
    />
</BootstrapperApplicationRef>

然后,正如您提到的在MSI包中设置MSI属性,这将被用户选择的位置覆盖

<MsiProperty Name="INSTALLFOLDER" Value="[InstallFolder]" />

如果要设置默认安装位置,请将捆绑包中的变量设置为默认值

<Variable Name="InstallFolder" Type="string" Value="[ProgramFilesFolder]Install"/>

我无法设置默认安装位置。我使用的是RtfLicense模板,我设置了变量(在Bundle内部,但在Chain外部),但是初始安装文件夹是空的。
<Variable Name="InstallFolder" Type="string" Value="[ProgramFilesFolder]Install"/>