The 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. At a minimum, it should contain a Source
attribute that identifies the path to the file on your development machine, as shown:
<Component Id="CMP_MyProgramEXE"
Guid="2C34F22F-1F48-4949-B68B-939F852F8B35">
<File Source="MyProgram.exe" />
</Component>
There are a number of optional attributes available. The Name
attribute tells the installer what the file will be called after it's installed. If omitted, the file will retain its original name as specified in the Source
attribute. The KeyPath
attribute explicitly marks the file as the keypath for the component, although if there is only one File
element in Component
it will, by default, be the keypath. The Id
attribute uniquely identifies the file in the MSI database's File
table. The following is an example that demonstrates these attributes:
<Component Id="CMP_MyProgramEXE" ...