WiX Database XML Schema

Element: CopyFile

Description

Copy or move an existing file on the target machine, or copy a file that is being installed, to another destination.

Derived By

Restricting anyType

Attributes

Name  Type  Required?  Default  Description 
Id  string  Yes    Primary key used to identify this particular entry.
FileId  string  No    This attribute cannot be specified if the element is nested under a File element.
SourceDirectory  string  No    This attribute cannot be specified if the element is nested under a File element or the FileId attribute is specified.
SourceProperty  string  No    This attribute cannot be specified if the element is nested under a File element or the FileId attribute is specified.
SourceName  WildCardLongFileNameType  No    This attribute cannot be specified if the element is nested under a File element or the FileId attribute is specified.
DestinationDirectory  string  No    Set this value to the destination directory where an existing file on the target machine should be moved or copied to.
DestinationProperty  string  No    Set this value to a property that will have a value that resolves to the full path of the destination directory.
DestinationName  LongFileNameType  No    In prior versions of the WiX toolset, this attribute specified the short file name.
DestinationLongName  LongFileNameType  No     
DestinationShortName  ShortFileNameType  No    The short file name of the file in 8.3 format.
Delete  YesNoType  No    This attribute cannot be specified if the element is nested under a File element or the FileId attribute is specified.

Content Model

Always empty.

Referenced By

Remarks

When this element is nested under a File element, the parent file will be installed, then copied to the specified destination if the parent component of the file is selected for installation or removal. When this element is nested under a Component element and no FileId attribute is specified, the file to copy or move must already be on the target machine.

When this element is nested under a Component element and the FileId attribute is specified, the specified file is installed, then copied to the specified destination if the parent component is selected for installation or removal (use this option to control the copy of a file in a different component by the parent component's installation state). If the specified destination directory is the same as the directory containing the original file and the name for the proposed source file is the same as the original, then no action takes place.

Definition

<xs:element name="CopyFile">
<xs:annotation>
<xs:appinfo>
<xse:seeAlso ref="RemoveFile" xmlns:xse="http://schemas.microsoft.com/wix/2005/XmlSchemaExtension" />
<xse:msiRef table="DuplicateFile" href="http://msdn.microsoft.com/library/aa368335.aspx" xmlns:xse="http://schemas.microsoft.com/wix/2005/XmlSchemaExtension" />
<xse:msiRef table="MoveFile" href="http://msdn.microsoft.com/library/aa370055.aspx" xmlns:xse="http://schemas.microsoft.com/wix/2005/XmlSchemaExtension" />
</xs:appinfo>
<xs:documentation>
Copy or move an existing file on the target machine, or copy a file that is being installed, to another destination. When
this element is nested under a File element, the parent file will be installed, then copied to the specified destination
if the parent component of the file is selected for installation or removal. When this element is nested under
a Component element and no FileId attribute is specified, the file to copy or move must already be on the target machine.
When this element is nested under a Component element and the FileId attribute is specified, the specified file is installed,
then copied to the specified destination if the parent component is selected for installation or removal (use
this option to control the copy of a file in a different component by the parent component's installation state). If the
specified destination directory is the same as the directory containing the original file and the name for the proposed source
file is the same as the original, then no action takes place.
</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:attribute name="Id" type="xs:string" use="required">
<xs:annotation>
<xs:documentation>Primary key used to identify this particular entry.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="FileId" type="xs:string">
<xs:annotation>
<xs:documentation>
This attribute cannot be specified if the element is nested under a File element. Set this attribute's value to the identifier
of a file from a different component to copy it based on the install state of the parent component.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="SourceDirectory" type="xs:string">
<xs:annotation>
<xs:documentation>
This attribute cannot be specified if the element is nested under a File element or the FileId attribute is specified. Set
this value to the source directory from which to copy or move an existing file on the target machine. This Directory must
exist in the installer database at creation time. This attribute cannot be specified in conjunction with SourceProperty.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="SourceProperty" type="xs:string">
<xs:annotation>
<xs:documentation>
This attribute cannot be specified if the element is nested under a File element or the FileId attribute is specified. Set
this value to a property that will have a value that resolves to the full path of the source directory (or full path
including file name if SourceName is not specified). The property does not have to exist in the installer database at
creation time; it could be created at installation time by a custom action, on the command line, etc. This attribute
cannot be specified in conjunction with SourceDirectory.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="SourceName" type="WildCardLongFileNameType">
<xs:annotation>
<xs:documentation>
This attribute cannot be specified if the element is nested under a File element or the FileId attribute is specified. Set
this value to the localizable name of the file(s) to be copied or moved. All of the files that
match the wild card will be removed from the specified directory. The value is a filename that may also
contain the wild card characters "?" for any single character or "*" for zero or more occurrences of any character. If this
attribute is not specified (and this element is not nested under a File element or specify a FileId attribute) then the
SourceProperty attribute should be set to the name of a property that will resolve to the full path of the source filename.
If the value of this attribute contains a "*" wildcard and the DestinationName attribute is specified, all moved or copied
files retain the file names from their sources.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="DestinationDirectory" type="xs:string">
<xs:annotation>
<xs:documentation>
Set this value to the destination directory where an existing file on the target machine should be moved or copied to. This
Directory must exist in the installer database at creation time. This attribute cannot be specified in conjunction with
DestinationProperty.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="DestinationProperty" type="xs:string">
<xs:annotation>
<xs:documentation>
Set this value to a property that will have a value that resolves to the full path of the destination directory. The property
does not have to exist in the installer database at creation time; it could be created at installation time by a custom
action, on the command line, etc. This attribute cannot be specified in conjunction with DestinationDirectory.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="DestinationName" type="LongFileNameType">
<xs:annotation>
<xs:documentation>
In prior versions of the WiX toolset, this attribute specified the short file name.
Now set this value to the localizable name to be given to the original file after it is moved or copied.
If this attribute is not specified, then the destination file is given the same name as the source file.
If a short file name is specified, the DestinationShortName attribute may not be specified.
If a long file name is specified, the DestinationLongName attribute may not be specified.
Also, if this value is a long file name, the DestinationShortName attribute may be omitted to
allow WiX to attempt to generate a unique short file name.
However, if this name collides with another file or you wish to manually specify
the short file name, then the DestinationShortName attribute may be specified.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="DestinationLongName" type="LongFileNameType">
<xs:annotation>
<xs:appinfo>
<xse:deprecated ref="DestinationName" xmlns:xse="http://schemas.microsoft.com/wix/2005/XmlSchemaExtension" />
</xs:appinfo>
</xs:annotation>
</xs:attribute>
<xs:attribute name="DestinationShortName" type="ShortFileNameType">
<xs:annotation>
<xs:documentation>
The short file name of the file in 8.3 format.
This attribute should only be set if there is a conflict between generated short file names
or you wish to manually specify the short file name.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Delete" type="YesNoType">
<xs:annotation>
<xs:documentation>
This attribute cannot be specified if the element is nested under a File element or the FileId attribute is specified. In other
cases, if the attribute is not specified, the default value is "no" and the file is copied, not moved. Set the value to "yes"
in order to move the file (thus deleting the source file) instead of copying it.
</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>