File attributes

Reference information
Project page Files and Folders
Related topics Working with attribute panes

Introduction

A File object represents a file for installation or removal. You can add or remove files, and you can optionally register them if they contain self-registration code.

Installation or removal of a file is controlled by its component. If the component is installed, the file's Install action is executed (which may actually remove the file); if the component is removed, the Remove action is executed. If a file is not linked to a component, its Install action is executed during installation of your product, and its Remove action when the product is removed.

MSI note Windows Installer requires that all files are linked to components; Tarma ExpertInstall will issue a BLD:E0072 diagnostic message if this is not the case.

Installation actions

The installer can create or remove files during product installation. The effect of the actions differs somewhat between Tarma Installer and Windows Installer, because Windows Installer does not support the full complement of installation actions. The following installation actions are available for files:

Install action Tarma Installer Windows Installer

Do not install

The installation file is not installed. If it is already present on the target system, it is left unchanged. Same
Install if not present The installation file is only installed if it does not already exist. If it is already present on the target system, it is left unchanged. Not supported. Behaves as Install if newer.
Install if present The installation file is only installed if it already exists. In that case, the existing file is replaced by the installation file if the installation file is newer than the existing file. See File version comparisons below for information about "newer" files.
Install if not modified If the installation file does not yet exist on the target system, it is installed. If the installation file already exists, the existing file is replaced by the installation file only if the existing file has not been modified (i.e., if its Modified date is earlier than its Created date) and if the installation file is newer than the existing file. See File version comparisons below for information about "newer" files.
Install if newer

If the installation file does not yet exist on the target system, it is installed. If the installation file already exists, the existing file is replaced by the installation file only if the installation file is newer than the existing file. See File version comparisons below for information about "newer" files.

Note: This is the recommended action for Add-on and update installers.

Same
Install always The installation file is installed and the existing file, if any, is replaced by the installation file regardless of versioning considerations. Not supported. Behaves as Install if newer.
Remove If the installation file exists, it is removed. Note that the actual file removal is still subject to its SharedDlls reference count; see Shared file below for more information. Same (but see the note under Shared file below).

Removal actions

The installer can remove or retain files during product removal. The effect of the actions differs somewhat between Tarma Installer and Windows Installer, because Windows Installer does not support the full complement of removal actions. The following remove actions are available for files:

Remove action Tarma Installer Windows Installer
Do not remove The installation file is left as-is. Not supported. Behaves as Remove always.
Remove if installed If the installation file exists it is removed if, and only if, it was newly installed by the current installer. If it was left unchanged or if an existing file was replaced by a new one during installation, the file is not removed. Note that the actual file removal is still subject to its SharedDlls reference count; see Shared file below for more information.
Remove always If the installation file exists, it is removed. Note that the actual file removal is still subject to its SharedDlls reference count; see Shared file below for more information. Same (but see the note under Shared file below).
Restore original

Restores the version of the file that was present before the current product was installed. If no new version was installed (for example, if the pre-existing version was up to date), nothing happens. If there was no pre-existing file at all, the current file is removed as per Remove always.

Restoration of a shared file is subject to its SharedDlls reference count (see below); if this count is > 0 after decrementing, the file is not restored but left as-is. This prevents problems in the sharing products, which might rely on the current version of the file.

Note: This is the recommended action for Add-on and update installers.

Not supported. Behaves as Remove always.

File version comparisons

If the file installation depends on the versions of the existing and installation files, the version comparison is performed as follows and in the order shown. Note that the rules differ slightly between Tarma Installer and Windows Installer.

Situation Tarma Installer versioning rules Windows Installer versioning rules
Both files have a VERSIONINFO resource
  1. Compare the ProductVersions (binary). The file with the higher ProductVersion is newer.
  2. If both ProductVersions are equal, compare the FileVersions. The file with the higher FileVersion is newer.
  3. If the FileVersions are also equal, both files have the same version.
  1. Compare the ProductVersions (binary). The file with the higher ProductVersion is newer.
  2. If both ProductVersions are equal, compare supported languages. The file with language that best matches the installation language or includes the largest selection of languages is used.
  3. If the languages are also equal, both files have the same version.
Only one file has a VERSIONINFO resource
  1. The file with the VERSIONINFO resource is newer, regardless of its actual version.
  1. The file with the VERSIONINFO resource is newer, regardless of its actual version.
Neither file has a VERSIONINFO resource
  1. The file with the later Modified date is newer.
  2. If the Modified dates are equal, both files have the same version.
  1. If the existing file has a Modified date later than its Created date, it is retained.
  2. The file with the later Modified date is newer.
  3. If the Modified dates are equal, both files have the same version.

Windows File Protection

Tarma Installer complies with the Windows File Protection (WFP) requirements on Windows Me, 2000, XP, and later versions. If an installation file is protected by WFP, Tarma Installer will never physically install or remove the file. However, any other applicable actions, for example file registration and SharedDlls reference counting, are performed normally. (File unregistration is never performed, because the file will never be removed by Tarma Installer.)

File registration

The installer can register files during installation and unregister them before they are removed. The following registration actions are supported:

Registration Description
No self-registration Do not register the file.
Use DllRegisterServer Call the file's DllRegisterServer entry point to register the file, and DllUnregisterServer to unregister it. This is typically used with in-process COM servers such as ActiveX controls and others.
Use RegisterTypeLib

Register the file with the Win32 API RegisterTypeLib and unregister it with UnRegisterTypeLib. This is typically used with COM type libraries that do not contain their own registration code.

MSI note Windows Installer does not support this option. See Typelib for an alternative approach.

Run with /RegServer

Register the file by running it with the /RegServer command line argument and unregister it with the /UnregServer command line argument. This is typically used with stand-alone applications that contain their own registration code.

MSI note Windows Installer does not support this option. See File Type for alternative approaches.

Register as Font Register the file as a font on the target system. This is typically used with font files (TrueType, TrueType Collections, and OpenType).
Register as WinHelp

Register the file as a WinHelp file on the target system. This is typically used with WinHelp .hlp files; do not use it with HTML Help .chm files.

MSI note Windows Installer does not support this option. If you want to use a WinHelp file, you must do so using a registry value under HKLM\Software\Microsoft\Windows\Help.

Attributes

This pane contains the following attributes and options.

Attribute Description
Install name

Enter the installation name of the file; this is the name under which the file will be installed. By default, it is set to the file name in the Source path, but you can change this if desired.

File alias

Enter the alias for the file. This alias must be unique in the project; it is used as a key in the Windows Installer database. Both Tarma Installer and Windows Installer use the alias to retrieve the file's installation path using the <#file_alias> syntax.

Note: Windows Installer can also use [#file_alias], but the Tarma <#file_alias> syntax is preferred while working in Tarma ExpertInstall because it allows better preflight checking. The Tarma <#file_alias> syntax will automatically be converted to [#file_alias] when you build a Windows Installer installer.

Source path

Enter the source path of the file (i.e., the path to the file on your own system), or click ... (browse) to open the standard Open dialog box that allows you to select the desired file.

Note: Source paths are always displayed as fully qualified paths. However, by default Tarma ExpertInstall stores source paths as relative to the project file's folder. This allows you to move the entire project to a different location, or to access the project and its contents through a different path, for example through a network share on a shared file server.

To store source paths as absolute paths instead of relative paths in the project file, you must change the project default settings by choosing the File > Properties command from the main menu bar and selecting the Preferences page. The options on this page allow you to change the way the various file paths in the project file are stored.

Tip: To move the project file to a different location without moving its source files, use the File > Save Project As... command from the main menu bar. Do not move the project file itself manually, because that will break the relative paths (if any) in the project file.

Install action Select the desired installation action from the drop-down list. The installation action is executed when the file's component is installed. If the file is not linked to a component, the action is executed when the product as a whole is installed. See Installation actions above for a full list of installation actions.
Remove action Select the desired removal action from the drop-down list. The removal action is executed when the file's component is removed. If the file is not linked to a component, the action is executed when the product as a whole is removed. See Removal actions above for a full list of removal actions.
Registration Select the file registration mode from the drop-down list. See File registration above for a full list of file registration actions.
DllInstall

Check this box and enter the arguments for the file's DllInstall function if the file needs to be registered through its DllInstall entry point; clear it for no additional file registration. This is in addition to the Registration self-registration option.

App Paths

Check this box and enter a semicolon-delimited list of search paths for the file if any App Paths registration must take place for the file; clear it for no App Paths registration.

App Paths registration registers the file name and its location in the Windows registry and optionally adds application-specific search paths that are used when the application loads DLLs.

Shared file

Check this box to indicate a shared file; clear it for an application-private file.

If you mark an installation file as Shared file, its SharedDlls reference count is incremented when the file is installed. This is true even if the file is not physically installed, for example when the existing version is reused because of versioning considerations.

Conversely, when a shared file is removed its SharedDlls reference count is decremented. The file is only physically removed from the target system if both its SharedDlls reference count is zero and its removal condition is satisfied.

MSI note Windows Installer only maintains the SharedDlls reference count for the key file in a component if that file is marked Shared file or if the file has a pre-existing reference count. For other files, no reference counting takes place, irrespective of the Shared file option.

Reboot if installed Check this box to schedule a reboot if the file is installed; clear it for no reboot. This option only has effect if the file is physically installed; if the existing version of the file on the target system is reused, no reboot is scheduled.
No rollback

Check this box to exclude the file from any installation rollback; clear it to let the file participate in the rollback, if any.

An installation rollback is performed if the installation fails; in that case, any files that were replaced prior to the failure are restored to their original versions. However, this requires additional disk space during installation (to save copies of the original files), so for very large files that are not critical, you might choose to disable the rollback functionality.

Archive
Read-only
Hidden
System

Check these boxes to set the corresponding file attribute when the file is installed; clear them to install the file without the corresponding attribute. These attributes are initialized from the source file's attributes, except for Archive, which is always cleared.