Wix安装路径注册表值分配 - 出了什么问题



我有一个WIX安装程序。在这种情况下,我尝试根据安装路径(VS 安装程序简单)添加一个注册表项,认为这将是小菜一碟......这是我的 WIX XML:

<Feature Id="ProductFeature" Title="ChessBarInfoSetup" Level="1">
        <!--<ComponentGroupRef Id="ProductComponents" />-->
  <ComponentRef Id='InstallRegistryComponent' />
  <ComponentRef Id='ProductComponent' />
    </Feature>
</Product>
<Fragment>
    <Directory Id="TARGETDIR" Name="SourceDir">
        <Directory Id="ProgramFilesFolder">
    <Directory Id="ManufacturerFolder" Name="$(var.manufacturer)">
      <Directory Id="INSTALLFOLDER" Name="$(var.productName)">
        <!--<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">-->
          <Component Id="InstallRegistryComponent" Guid="*">
            <RegistryKey Id='ChessInfoBarInstallDir' Root='HKLM' Key='Software[Manufacturer][ProductName]' Action='createAndRemoveOnUninstall'>
              <RegistryValue Type='string' Name='InstallDir' Value="[INSTALLDIR]" Action="write" KeyPath="yes" />
              <!--<RegistryValue Type='integer' Name='Flag' Value='0'/>-->
            </RegistryKey>
          </Component>
          <!-- TODO: Remove the comments around this Component element and the ComponentRef below in order to add resources to this installer. -->
          <Component Id="ProductComponent" Guid="*">
            <File Source="$(var.ChessInfoTaskBar.TargetPath)" />
          </Component>
        <!--</ComponentGroup>-->
      </Directory>
    </Directory>
        </Directory> 
</Directory>
</Fragment>

该值已创建,但始终为空字符串。尝试过安装位置和其他...我做错了什么(在 wix 教程页面上看到 Value=[INSTALLDIR])?

它是空的,因为你使用的是INSTALLDIR而不是INSTALLFOLDER

<Directory Id="INSTALLFOLDER" Name="$(var.productName)">
<RegistryValue Type='string' Name='InstallDir' Value="[INSTALLFOLDER]" />

这应该会给你安装目录。

最新更新