InstallerTaskBase.

InstallerComponentsElement Property

Summary

Groups sets of files into named sets, these can be used to install and perform operations on a set of files as one entity.

Parameters

Attribute Type Description Required
name string A name used to refer to the component. True
id string A string GUID unique to this component, version, and language.
Note that the letters of these GUIDs must be uppercase. Utilities such as GUIDGEN can generate GUIDs containing lowercase letters. The lowercase letters must be changed to uppercase to make these valid component code GUIDs.
True
attr int This column contains a bit flag that specifies options for remote execution. Add the indicated bit to the total value in the column to include an option. DescriptionComponent cannot be run from source.
Set this bit for all components belonging to a feature to prevent the feature from being run-from-network or run-from-source. Note that if a feature has no components, the feature always shows run-from-source and run-from-my-computer as valid options.
Component can only be run from source.
Set this bit for all components belonging to a feature to prevent the feature from being run-from-my-computer. Note that if a feature has no components, the feature always shows run-from-source and run-from-my-computer as valid options.
Component can run locally or from source.If this bit is set, the value in the key element is used as a key into the Registry table.
If the Value field of the corresponding record in the Registry table is null, the Name field in that record must not contain "+", "-", or "*". For more information, see the description of the Name field in Registry table.
Setting this bit is recommended for registry entries written to the HKCU hive. This ensures the installer writes the necessary HKCU registry entries when there are multiple users on the same machine.
If this bit is set, the installer does not remove the component during an uninstall. The installer registers an extra system client for the component in the Windows Installer registry settings. If this bit is set, the value in the KeyPath column is a key into the ODBCDataSource table.If this bit is set, the installer reevaluates the value of the statement in the Condition column upon a reinstall. If the value was previously False and has changed to True, the installer installs the component. If the value was previously True and has changed to False, the installer removes the component even if the component has other products as clients.
This bit should only be set for transitive components. See Using Transitive Components.
If this bit is set, the installer does not install or reinstall the component if a key path file or a key path registry entry for the component already exists. The application does register itself as a client of the component.
Use this flag only for components that are being registered by the Registry table.
Set this bit to mark this as a 64-bit component. This attribute facilitates the installation of packages that include both 32-bit and 64-bit components. If this bit is not set, the component is registered as a 32-bit component.
Value
0
1
2
4
16
32
64
128
256
True
directory string Refrence to a directory. Defines the directory location for where the files assigned to the component are to be placed. True
feature string Refrence to a feature. Maps a feature to the component. Used to determine if the component is to be installed or not. True
condition string A conditional statement that can control whether a component is installed. If the condition is null or evaluates to true, then the component is enabled. If the condition evaluates to False, then the component is disabled and is not installed. False
fileattr int Integer containing bit flags representing file attributes.
The following table shows the definition of the bit field. DescriptionRead-OnlyHiddenSystemThe file is vital for the proper operation of the component to which it belongsThe file contains a valid checksum. A checksum is required to repair a file that has become corrupted.This bit must only be added by a patch and if the file is being added by the patch.The file's source type is uncompressed. If set, ignore the Word Count Summary Property. If neither msidbFileAttributesNoncompressed or msidbFileAttributesCompressed are set, the compression state of the file is specified by the Word Count Summary Property. Do not set both msidbFileAttributesNoncompressed and msidbFileAttributesCompressed.The file's source type is compressed. If set, ignore the Word Count Summary Property. If neither msidbFileAttributesNoncompressed or msidbFileAttributesCompressed are set, the compression state of the file is specified by the Word Count Summary Property. Do not set both msidbFileAttributesNoncompressed and msidbFileAttributesCompressed.
Value
1
2
4
512
1024
4096
8192
16384
False
checkinterop bool Used to determine if file(s) in the fileset are interop file(s). If true, extra information will be added in the install package to register each interop file. If false, the file(s) will not be not be checked and the extra registration information will not be added to the msi. False
installassembliestogac bool Used to determine if assemblies should be installed to the Global Assembly Cache. If true, all assemblies in the fileset will be added to the GAC. If false, the assemblies will be installed to the specified directory (as a normal file would). Note: If an assembly is specified to be installed into the GAC, it will not also be installed to the directory specified. False
keepsubdirs bool Used to determine if directories in the fileset should be built. If true, all subdirectories of the fileset basedir will be built. If false the directories structure will be flattened. The default is false. False

Nested Elements:

<keyfile>

    This value points to a file or folder belonging to the component that the installer uses to detect the component. Two components cannot share the same key path value.

    Parameters

    Attribute Type Description Required file string Name of the key (file) to use. Also, this could be an id of a registry key value. True

</keyfile>

<fileset>

    Specifies the files to include with the component

</fileset>

<forceid>

    Used to force specific attributes on a per file basis

    Parameters

    Attribute Type Description Required file string Name of the file, in the fileset, to override. True id string Unique GUID to assign to the file. True attr int Integer containing bit flags representing file attributes.
    The following table shows the definition of the bit field. Value Description 1 Read-Only 2 Hidden 4 System 512 The file is vital for the proper operation of the component to which it belongs 1024 The file contains a valid checksum. A checksum is required to repair a file that has become corrupted. 4096 This bit must only be added by a patch and if the file is being added by the patch. 8192 The file's source type is uncompressed. If set, ignore the Word Count Summary Property. If neither msidbFileAttributesNoncompressed or msidbFileAttributesCompressed are set, the compression state of the file is specified by the Word Count Summary Property. Do not set both msidbFileAttributesNoncompressed and msidbFileAttributesCompressed. 16384 The file's source type is compressed. If set, ignore the Word Count Summary Property. If neither msidbFileAttributesNoncompressed or msidbFileAttributesCompressed are set, the compression state of the file is specified by the Word Count Summary Property. Do not set both msidbFileAttributesNoncompressed and msidbFileAttributesCompressed.
    False
    version string This field is the version string for a versioned file. This field is blank for non-versioned files. False language string A list of decimal language IDs separated by commas. False checkinterop bool Used to determine if file is an interop file. If true, extra information will be added in the install package to register the interop file. If false, the file will not be not be checked and the extra registration information will not be added to the msi. False installtogac bool If true, and if the file is an assembly, it will be installed to the GAC. If false, the file will be installed to the directory specified by the component. Note: If an assembly is specified to be installed into the GAC, it will not also be installed to the directory specified. False

</forceid>

Examples

Define a sample component structure. <components> <component name="C__MainFiles" id="{26AA7144-E683-441D-9843-3C79AEC1C636}" attr="2" directory="TARGETDIR" feature="F__MainFiles" > <key file="default.aspx" /> <fileset basedir="${install.dir}"> <include name="*.*" /> </fileset> </component> </components> Install files to TARGETDIR and assemblies to the GAC (Global Assembly Cache). Do not install MyOtherAssembly.dll to the GAC, but rather install it with the other files (to TARGETDIR) <components> <component name="C__MainFiles" id="{26AA7144-E683-441D-9843-3C79AEC1C636}" attr="2" directory="TARGETDIR" feature="F__MainFiles" installassembliestogac="true" > <key file="MyAssemblyName.xml" /> <fileset basedir="${install.dir}"> <include name="*.*" /> </fileset> <forceid file="MyOtherAssembly.dll" id="_4EB7CCB23D394958988ED817DA00B9D1" installtogac="false" /> </component> </components> Assign a registry entry to a specific component. <components> <component name="C__RegistryEntry" id="{06C654AA-273D-4E39-885C-3E5225D9F336}" attr="4" directory="TARGETDIR" feature="F__DefaultFeature" > <key file="R__822EC365A8754FACBF6C713BFE4E57F0" /> </component> </components> . . . <registry> <key path="SOFTWARE\MyCompany\MyProduct\" root="machine" component="C__RegistryEntry"> <value id="R__822EC365A8754FACBF6C713BFE4E57F0" name="MyKeyName" value="MyKeyValue" /> </key> </registry>
Assembly
NAnt.Contrib.dll
Namespace
NAnt.Contrib.Tasks.Msi
Containing Type
InstallerTaskBase

Syntax

[BuildElement("components", ProcessXml = false)]
public SchemaElement[] InstallerComponentsElement { get; set; }

Attributes

Type Description
BuildElement

Value

Type Description
SchemaElement[]