WiX 3.0 Teaming Engine: Source Attribute Value
What is the purpose of the Source attribute? Take 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 meaning, what does Source add? The code won't compile without it.
Where can I find documentation that explains these attributes? I tried MSDN for MSI but couldn't find an answer.
Thanks.
a source to share
File / @ Source provides the location to get information about the file (size, language, hash) and copy it to the desired location (either in the closet or in the directory related to the MSI file).
File / @ Name is optional unless you want to install a file with a different name. In other words, if the file exists with the correct name on your build machine, simply refer to it with File / @ Source and leave the file / @ Name.
The / @ Id file is also optional as your filename is unique. You cannot have two files with the same file / @ Id, so add File / @ Id if you experience collisions.
In WiX v3.5, I often just do:
<Component>
<File Source="my.exe"/>
</Component>
a source to share
WiX and MSI are not the same. Hence, no reference in the MSDN documentation;)
You need to refer to WiX.CHM where you installed WiX, or WiX online documentation .
Assuming you are talking about File/@Name
and File/@Source
, this is not necessary if the source files are laid out the same as your WiX directory structure.
The trivial part comes when you use multiple arguments -b
for light
and SourceDir
in an attribute File/@Source
. For instance...
<File Id="example.dll" KeyPath="yes" Source="SourceDir\example.dll" DefaultLanguage="0" />
I usually specify 4 folders with -b
in my standard assembly. One for the various specs of the installer, one for where I store the merge modules, one for the shared resources between all my installations, and one for my source files. Now WiX will look in every directory given on the command line, which makes things a lot more portable if I create another system with a different directory layout.
According to the documentation , if (in your example) myfile.dll
was in the current directory, you can omit the File/@Source
attribute.
a source to share