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">
 

Get WiX: A Developer's Guide to Windows Installer XML now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.