File element
The File
element, as you've seen, is used to designate each file that you plan to copy to the end user's computer. Its Source
attribute tells WiX where to find the file on your local machine. The Name
attribute tells the installer what the file will be called after it's installed. Each File
element also needs an Id
. This uniquely identifies it in the MSI database's File table.
<Component Id="CMP_MyProgramEXE" Guid="E8A58B7B-F031-4548-9BDD-7A6796C8460D"> <File Id="FILE_MyProgramEXE" Source="MyProgram.exe" Name="NewName.exe" KeyPath="yes" /> </Component> <Component Id="CMP_AnotherFileDLL" Guid="E9D74961-DF9B-4130-8FBC-1669A6DD288E"> <File Id="FILE_AnotherFileDLL" Source="..\..\AnotherFile.dll" KeyPath="yes" /> </Component>
This example includes two files, MyProgram.exe
and AnotherFile.dll
, in the installation package. Both use relative paths for their Source
attributes. The...