1

我对 WIX 基本设置配置有一些问题。我想将我的文件安装到 ProgramFiles/NameOfCompany/NameOfProduct。我现在有以下配置:

<?define ProductName="ProductName" ?>
<?define Manufacturer="CompanyName"?>
<Directory Id="TARGETDIR" Name="SourceDir">
  <Directory Id="ProgramFilesFolder">
    <Directory Id="INSTALLLOCATION" Name="$(var.ProductName)">
      <Component Id="ProductComponent" Guid="b11556a2-e066-4393-af5c-9c9210187eb2">
        <File Id='SampleAppEXE' Name='SampleApp.exe' Source='ClipboardActiveX.dll' Vital='yes' />
      </Component>
    </Directory>
  </Directory>
</Directory>

问题是,当我尝试在 INSTALLLOCATION 目录条目中设置类似 folder1/folder2 的内容时出现以下错误:

The Directory/@Name attribute's value, 'folder1/folder2', is not a valid long name because it contains illegal characters.  Legal long names contain no more than 260 characters and must contain at least one non-period character.  Any character except for the follow may be used: \ ? | > < : / * ".

我想要这样的东西:

<?define ProductName="ProductName" ?>
<?define Manufacturer="CompanyName"?>
<Directory Id="TARGETDIR" Name="SourceDir">
  <Directory Id="ProgramFilesFolder">
    <Directory Id="INSTALLLOCATION" Name="$(var.Manufacturer)\$(var.ProductName)">
      <Component Id="ProductComponent" Guid="b11556a2-e066-4393-af5c-9c9210187eb2">
        <File Id='SampleAppEXE' Name='SampleApp.exe' Source='ClipboardActiveX.dll' Vital='yes' />
      </Component>
    </Directory>
  </Directory>
</Directory>
4

1 回答 1

4

您必须对嵌套目录使用嵌套的 Directory 元素。像这样:

...
<Directory Id="ProgramFilesFolder">
    <Directory Id="Manufacturer" Name="$(var.Manufacturer)">
        <Directory Id="INSTALLLOCATION" Name="$(var.ProductName)">
...
于 2013-07-19T17:48:17.910 回答