Copying and moving files
File
and Component
elements allow you to add new files to the end user's computer. However, WiX also provides ways to copy and move files. For these tasks, you'll use the CopyFile
element. We'll discuss how to use it in the following sections.
Copying files you install
The CopyFile
element can copy a file that you're installing and place it in another directory. You'll nest it inside the File
element of the file you want to duplicate. First, we'll add a subdirectory to the MyProgramDir
folder that we're already creating under Program Files. The new directory will be called Copied
Files
.
<Directory Id="TARGETDIR" Name="SourceDir"> <Directory Id="ProgramFilesFolder"> <Directory Id="MyProgramDir" Name="Awesome Software"> <Directory Id="CopiedFiles" Name="Copied Files" /> </Directory> </Directory> </Directory>
Now, we can nest a CopyFile
element inside the File
element...