Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you copy a set of files to multiple places using 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?

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

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

like image 802
Keith Nicholas Avatar asked Oct 13 '09 02:10

Keith Nicholas


Video Answer


2 Answers

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>
like image 195
Wim Coenen Avatar answered Oct 24 '22 03:10

Wim Coenen


Duplicate Files: Windows Installer has its own concept for this called "DuplicateFiles". It only works if the files are actually identical, but it sounds like that's what you want.

CopyFile Element: In WIX you implement this via the CopyFile element:

http://wix.sourceforge.net/manual-wix2/wix_xsd_copyfile.htm

I haven't actually tried it, but it should look something like this

<Component Id='Manual' Guid='*' >
  <File Id='Manual' Name='Manual.pdf' Source='Manual.pdf' KeyPath='yes'>
    <CopyFile  Id='MyDuplicateFile1' DestinationProperty ='DesktopFolder'/>
  </File>
</Component>
like image 31
Stein Åsmul Avatar answered Oct 24 '22 01:10

Stein Åsmul