0

这是我正在尝试做的一个例子:

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="SetupProject1" Language="1033" Version="1.0.0.0" Manufacturer="MySoftware" UpgradeCode="d2192e52-f4f6-461c-9d8e-eb66067df09a">
    <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">
        <ComponentGroupRef Id="ProductComponents" />
    </Feature>
</Product>

<Fragment>
    <Directory Id="TARGETDIR" Name="SourceDir">
        <Directory Id="ProgramFilesFolder">
            <Directory Id="INSTALLFOLDER" Name="[Manufacturer] SetupProject1" />
        </Directory>
    </Directory>
</Fragment>

<Fragment>
    <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
        <!-- TODO: Remove the comments around this Component element and the ComponentRef below in order to add resources to this installer. -->
        <!-- <Component Id="ProductComponent"> -->
            <!-- TODO: Insert files, registry keys, and other resources here. -->
        <!-- </Component> -->
  <Component Id="CMP_NEW">
    <File Id="FILE_NEW" Source="New Text Document.txt" KeyPath="yes" />
  </Component>
    </ComponentGroup>
</Fragment>

在 ProgramFiles 中创建的文件夹是[Manufacturer] SetupProject1而不是MySoftware SetupProject1. 我做对了吗?如果没有,请问我该怎么做?

4

2 回答 2

0

创建一个变量 $(var.Manufacturer) 并像这样使用它:

像这样定义:<?define Manufacturer = "MySoftware"?>

<Product Id="*" Name="SetupProject1" Language="1033" Version="1.0.0.0" Manufacturer="$(var.Manufacturer)" UpgradeCode="d2192e52-f4f6-461c-9d8e-eb66067df09a">

<Directory Id="INSTALLFOLDER" Name="$(var.Manufacturer) SetupProject1" />

那可行..:)

于 2012-12-25T13:01:36.387 回答
0

我遇到的问题是您无法将预处理器变量设置为安装期间定义的值,例如在 UI 中。我正在尝试将目录名称设置为用户提供的属性。

So far the key way I've seen to get around this is to use a custom action to change the Directory datatable to the value of the property you would otherwise reference. Just make sure you time the custom action so that it doesn't happen before the directory is normally set, otherwise it might be overwritten.

I'm still looking for something a little prettier however.

于 2013-08-07T19:11:27.217 回答