Search code examples
installationwixwindows-installerwix3

WiX 3.0 Merge Module: meaning of Source attribute


What is the purpose of the Source attribute? Have a look at this snippet:

<Component Id="MyComponent" Guid="123456789-abcd-defa-1234-DCEA-01234567890A">
          <File Id="myFile" Name="myFile.dll" Source="myFile.dll"/>
</Component>

Since Name and Source have the same value, what does Source add? The code does not compile without it.

Where can I find documentation that explains these attributes? I have tried MSDN for MSI but did not find an answer.

Thanks.


Solution

  • File/@Source provides the location to get information about the file (size, language, hash) and to copy it to the correct location (either in a cabinet or laid out in a directory relative to the MSI file).

    File/@Name is optional if you do not want to install the file with a different name. In other words, if the file exists with the right name on your build machine, just refer to it using the File/@Source and leave off File/@Name.

    File/@Id is also optional as long your file name is unique. You cannot have two files with the same File/@Id so add File/@Id when you have collisions.

    In WiX v3.5 I often just do:

    <Component> <File Source="my.exe"/> </Component>