Wix安装路径注册表值赋值 - 有什么问题?

时间:2012-11-18 19:42:09

标签: xml wix windows-installer

我有一个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])?

1 个答案:

答案 0 :(得分:9)

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

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

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

那应该会给你安装目录。