如何使用 Wix 将一组文件复制到多个位置? [英] How do you copy a set of files to multiple places using Wix?

查看:38
本文介绍了如何使用 Wix 将一组文件复制到多个位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试进行安装,将相同文件的副本放在多个位置...

I'm trying to make an install that puts a copy of the same files in multiple places...

有没有简单的方法可以做到这一点?

is there a simple way to do this?

例如.如果我想将 a.txt b.txt c.txt 放入以下所有目录:-

eg. if I wanted to put a.txt b.txt c.txt into all of the following directories :-

.\废话\
.\Txts\
.\示例\

.\Blah\
.\Txts\
.\Examples\

推荐答案

只需创建多个引用同一个文件的组件,但将其安装到不同的位置.唯一的问题是您不能使用两个 <File Source="somefile"/> 元素引用同一个文件,因为它们将获得相同的自动生成的 ID.明确地为文件元素指定不同的 ID 以避免该问题.

Simply create multiple components which reference the same file, but install it to different locations. The only gotcha is that you cannot use two <File Source="somefile"/> elements referencing the same file because they will get the same auto-generated ID. Explicitly give the file elements different IDs to avoid that problem.

<DirectoryRef Id="directory1">
   <Component Id="somefile-component1">
      <File Id="somefile-id1" Source="/path/to/somefile"/>
   </Component>
</DirectoryRef>

<DirectoryRef Id="directory2">
   <Component Id="somefile-component2">
      <File Id="somefile-id2" Source="/path/to/somefile"/>
   </Component>
</DirectoryRef>

这篇关于如何使用 Wix 将一组文件复制到多个位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆