WIX 3.8安装程序:将文件添加到预先存在的文件夹



如何将文件直接安装到用户计算机上预先存在的文件夹中?我阅读的所有文档仅解释创建自定义 INSTALLDIR。

例如 c:\ProgramFiles(x86)\ExampleFolderA\ExampleFolderB\InstalledFile.exe

您应该首先定义目录结构:

<Directory Id="TARGETDIR" Name="SourceDir">
  <Directory Id="ProgramFilesFolder">
    <Directory Id="ExampleFolderAId" Name="ExampleFolderA">
      <Directory Id="ExampleFolderBId" Name="ExampleFolderB" />
    </Directory>
  </Directory>
</Directory>

请注意,上面的定义不会在安装运行时创建目录。为了实际"创建"目录,您必须将文件放置在那里(使用Component元素),或者明确声明目录为空。

像这样:

<DirectoryRef Id="ExampleFolderAId">
  <Component Id="SampleComponent" Guid="GUID-GOES-HERE">
    <File Id="SampleFile" Source="C:readme.txt" KeyPath="yes" />
  </Component>
</DirectoryRef>

<DirectoryRef Id="ExampleFolderBId">
  <Component Id="EmptyFolderComponent" Guid="GUID-GOES-HERE">
    <CreateFolder />
  </Component>
</DirectoryRef>

希望你明白这个想法。

最新更新