9

我有一个 WIX 安装程序。我尝试根据安装路径(VS Installer easy)添加一个注册表项,在这种情况下认为这将是小菜一碟......这是我的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>

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

4

1 回答 1

10

它是空的,因为您正在使用INSTALLDIR而不是INSTALLFOLDER

<Directory Id="INSTALLFOLDER" Name="$(var.productName)">

<RegistryValue Type='string' Name='InstallDir' Value="[INSTALLFOLDER]" />

那应该给你安装目录。

于 2012-11-19T09:47:22.363 回答