The cfgconfig.xml file is used to execute a set of commands before or after starting the installer on updating using cfg.exe.
The file structure must start with the <Start> chapter. All the other chapters must be located inside <Start>.
NOTE. Each of the chapters except for <Start> may be a subchapter of <Before> or <After> chapters that determine whether the set of commands is to be executed before or after the installer is started.
Determine the timeout for completing update (<Start>)
The <Start> element is used as a container for all commands, all the other chapters are stored in this element.
Attribute | Description |
Timeout | Determines the timeout for completing update of Foresight Analytics Platform. If the update is not completed when the time has elapsed (for example, it hangs up), it is forced to stop and then Foresight Analytics Platform is started. The value is set in seconds. Default value is 20 minutes. Set this attribute to "-1" to set unlimited timeout. |
<Start Timeout="7200">
<Cfg Copy="1"/>
</Start>
The estimated time of update completion is two hours.
Support custom shortcuts set to cfg.exe (<Cfg>)
To use custom shortcuts configured to cfg.exe, copy the new cfg.exe file to the current release folder.
To do this, create the <Cfg> section in cfgconfig.xml.
Attribute | Description |
Copy | Determines whether the file is copied: 1 - Copy. 0 - Do not copy. |
<Start>
<Cfg Copy="1"/>
</Start>
After a new version is installed, a folder of the previous release is created, where the cfg.exe new file is placed.
Determine actions executed with a file (<File>)
To determine actions executed with a file, create the <File> chapter in cfgconfig.xml
Attribute | Description |
Path | Determines the file name. Substitutions, system and custom variables can be used: %AllUsersProfile%, %AppData%, %CommonProgramFiles%, %HomeDrive%, %SystemDrive%, %HomePath%, %UserProfile%, %WinDir%, %SystemRoot%. |
Args | Determines command line arguments. Substitutions, system and custom variables can be used: %AllUsersProfile%, %AppData%, %CommonProgramFiles%, %HomeDrive%, %SystemDrive%, %HomePath%, %UserProfile%, %WinDir%, %SystemRoot%. |
Copy | Determines whether the file is copied: 1 - Copy. 0 - Do not copy. |
NoExec | Prohibits file execution: 1 - Do not execute file. 0 - Execute file. |
NoDb | Prohibits writing to database: 1 - Do not write to database. 0 - Write to database. |
NoTemp | Indicates whether the update file must be copied to a temporary folder: 1 - Do not copy. 0 - Copy. During the update the required MSI package, the files explicitly written in cfgconfig.xml in the Path attribute of the <File> chapter and, if required, the cfg.exe file and the lservrc file will be copied to a temporary folder.NOTE. To ensure proper execution of commands from cfgconfig.xml, all files used during their execution must be specified in the cfgconfig.xml file. Files with the NoDb="1" attribute will not be copied, if the NoTemp="0" attribute has not been determined. |
<Start>
<Before>
<File Path="cmd.exe" Args="/C">
<Return>
<Code Value="0" Message="Success" Break="N" />
<Code Value="-1" Message="Fail" Break="Y" />
</Return>
</File>
</Before>
<After>
<File Path="cmd.exe" Args="/C" />
</After>
</Start>
To update, run the command line with the specified parameter depending on the return code:
Updating is aborted.
Updating is continued. After updating the command line is run with the specified parameter.
<Start>
<After>
<File Path="my.dll" Args="#INSTALLDIR#\Foresight Analytics Platform 9.2" Copy="1" NoExec="1" />
<File Path="regsvr32.exe" Args="-s "#INSTALLDIR#\Foresight Analytics Platform 9.2\my.dll"" NoDb="1">
<Return>
<Code Value="-1" Break="Y" />
</Return>
</File>
</After>
</Start>
After the update is complete, the first <File> element copies the my.dll library from the update directory to the Foresight Analytics Platform (#INSTALLDIR#\Foresight Analytics Platform 9.2), the second <File> element registers the copied file my.dll and verifies response code.
If the Microsoft SQL Native Client is not installed on the computer, place cfgconfig.xml and sqlncli.exe in the update folder. The cfgconfig.xml file must have the following structure:
<Start>
<Before>
<File Path="sqlncli.exe"/>
</Before>
</Start>
The Microsoft SQL Native Client is installed before updating.
Create the <Code> subchapter in the <File> chapter.
Attribute | Description |
Value | Return code value. |
Message | Determines a message. |
Break | Determines the code, on which the operation is aborted or continued: Y. The operation is aborted. N. The operation is continued. |
<Start>
<Before>
<File Path="cmd.exe" Args="/C">
<Return>
<Code Value="0" Message="Success" Break="N" />
<Code Value="-1" Message="Fail" Break="Y" />
</Return>
</File>
</Before>
<After>
<File Path="cmd.exe" Args="/C" />
</After>
</Start>
Before updating the command line is started with the specified parameter and is updated:
It is aborted if the return code is equal to "-1" and the message is displayed.
It is continued if the return code is equal to zero and the message is displayed.
Determine settings according to the file presence and version (<FileCondition>)
Create the <FileCondition> subchapter in the <File> chapter. This chapter is an optional subchapter of <File>. It enables the user to check file presence and file version. When the file is present, it enables the user to redetermine file settings specified in the <File> section, for example, Path, Args, Copy, NoExec, and so on. The operation redetermined for the source file is executed after checking all conditions listed in the <File> chapter. If the Path attribute is redetermined, but its value is empty, the file specified in the <File> chapter is not installed.
Attribute | Description |
FileName | Full name of the file, presence of which is to be checked. Substitutions, system and custom variables can be used: %AllUsersProfile%, %AppData%, %CommonProgramFiles%, %HomeDrive%, %SystemDrive%, %HomePath%, %UserProfile%, %WinDir%, %SystemRoot%. |
VersionMask | File version mask. This attribute may be missing. If the attribute is specified, the file version specified in FileName is checked against this mask. If the file is found and matches the mask, the settings (for example, Path) are taken from this element. |
Cmp | Version comparison type. Available values: EQ (equal), LEQ (less or equal), GEQ (greater or equal), LS (less), GT (greater). EQ value is used by default if the attribute is not available. |
IsDefault | Determines whether the condition is satisfied without checking identifying attributes (FileName, VersionMask, Cmp). If the attribute is set to True, the identifying attributes are not checked, and the condition is assumed to be satisfied. If the condition specifies only the IsDefault="True" attribute, the operation determined in the <File> chapter is executed on the source file. The operation is executed after checking all conditions listed in the <File> chapter. The attribute is set to False by default. |
The update folder must contain the following distribution files: msxml6_x64.exe and msxml6_x86.exe.
<Start>
<Before>
<File Path="msxml6_x86.exe">
<FileCondition FileName="%systemroot%\system32\msxml6r.dll" Cmp="GEQ" VersionMask="6.*" Path="" />
<FileCondition IsDefault="True" />
<OsCondition Platform="x64" Path="msxml6_x64.exe" />
</File>
</Before>
</Start>
Before installing Foresight Analytics Platform the system checks if the msxml6r.dll file is available:
If the file is found and its version matches the specified one, the msxml6_x86.exe is not started (Path="").
If the file is not found or its version does not match the specified one (Cmp, VersionMask), condition checking is started (OsCondition). Either msxml6_x86.exe or msxml6_x64.exe is started depending on whether the condition is satisfied.
Determine file settings for a specific operating system and platform (<OsCondition>)
To determine file settings for a specific operating system and platform, create the <OsCondition> subchapter in the <File> chapter. This subchapter is optional.
The <File> attributes such as Path, Args, Copy, NoExec, and so on can be redetermined in the <OsCondition> element. The operation redetermined for the source file is executed after checking all conditions listed in the <File> chapter. If the Path attribute is redetermined, but its value is empty, the file specified in the <File> chapter is not installed.
Attribute | Description |
OsName | Operating system name. Available values: Win7, WinServer2008, WinServer2008R2. |
OsVersion | Operating system version in MajorVersion.MinorVersion format. It is used separately from OsName. The table below gives MajorVersion and MinorVersion values for operating systems. MinorVersion may be unavailable, for example: OsVersion = "5". In this case the condition is applied to all OS with MajorVersion = 5. |
ServicePack | Service pack number. Use semicolon to separate values. For example: ServicePack = "2;3". This means that the file is to be installed for SP2, SP3. |
Platform | Platform. Available values: x86, x64. If no platform is specified, the file is executed for all platforms. |
Cmp | OS version comparison type. Available values: EQ (equal), LEQ (less or equal), GEQ (greater or equal), LS (less), GT (greater). EQ value is used by default if the attribute is not available. |
IsDefault | Determines whether the condition is satisfied without checking identifying attributes (OsName, OsVersion, ServicePack, and so on). If the attribute is set to True, the identifying attributes are not checked, and the condition is assumed to be satisfied. If the condition specifies only the IsDefault="True" attribute, the operation determined in the <File> chapter is executed on the source file. The operation is executed after checking all conditions listed in the <File> chapter. The attribute is set to False by default. |
Operating System | MajorVersion | MinorVersion | OsName |
Windows Server 2008 | 6 | 0 | WinServer2008 |
Windows 7 | 6 | 1 | Win7 |
Windows Server 2008 R2 | 6 | 1 | WinServer2008R2 |
Windows 8 | 6 | 2 | Win8 |
Windows Server 2012 | 6 | 2 | WinServer2012 |
Windows 8.1 | 6 | 3 | Win8.1 |
Windows Server 2012 R2 | 6 | 3 | WinServer2012R2 |
Windows 10 | 10 | 0 | Win10 |
Windows Server 2016 | 10 | 0 | WinServer2016 |
The update folder must contain the following distribution files: vc_redist.x86.exe and VCRedistLauncher.exe.
<Start Timeout="-1">
<Before>
<File Path="vc_redist.x86.exe" NoExec="1"/>
<File Path="VCRedistLauncher.exe" Args="/install /passive /norestart">
<FileCondition FileName="#SYSTEM32DIR#\mfc140.dll" VersionMask="14.0.24212" Cmp="GEQ" Path=""/>
<FileCondition IsDefault="True"/>
<OsCondition OsVersion="6.0" ServicePack="2;3"/>
<OsCondition OsVersion="6.1" ServicePack="1;2"/>
<OsCondition OsVersion="6.2"/>
<OsCondition OsVersion="6.3"/>
<OsCondition OsVersion="10.0"/>
</File>
</Before>
</Start>
Before installing Foresight Analytics Platform the system checks if the mfc140.dll file is available:
If the file exists and its version is later or matches the checked version (Cmp, VersionMask), the distribution file is not started (Path="").
If the file does not exist or its version is earlier than the checked version, the VCRedistLauncher.exe file is started.
The file is started only in checked Windows versions:
Windows Server 2008;
Windows 7, Windows Server 2008 R2;
Windows 8, Windows Server 2012;
Windows 8.1, Windows Server 2012 R2;
Windows 10, Windows Server 2016.
Determine settings according to existence and value of key in the registry (<RegistryCondition>)
Create the <RegistryCondition> subchapter in the <File> chapter. This chapter is an optional subchapter of <File>. Determines file configuration depending on key availability in the registry and its value. If the key is found and its value matches the one specified in KeyValue, settings, (for example, Path) are taken from this element. If KeyPath and KeyName are set, the availability of this key is checked. When KeyName and KeyValue are not specified, only registry branch availability is checked. The <RegistryCondition> element can be used to redetermine <File> attributes such as Path, Args, Copy, NoExec, and so on. The operation redetermined for the source file is executed after checking all conditions listed in the <File> chapter. If the Path attribute is redetermined, but its value is empty, the file specified in the <File> chapter is not installed.
Attribute | Description |
KeyPath | The key path specified in the registry. The relative path is specified without [HKEY_LOCAL_MACHINE] or [HKEY_CURRENT_USER], the key is searched for the USER branch, then for the LOCAL_MACHINE branch. |
KeyName | Key name. Optional attribute. |
KeyValue | Key value. Optional attribute. |
IsDefault | Determines whether the condition is met without checking the identifying attributes (KeyPath, KeyName, KeyValue). If the attribute is set to True, the identifying attributes are not checked, and the condition is assumed to be satisfied. If the condition specifies only the IsDefault="True" attribute, the operation determined in the <File> chapter is executed on the source file. The operation is executed after checking all conditions listed in the <File> chapter. The attribute is set to False by default. |
Cmp | Version comparison type. Available values: EQ (equal), LEQ (less or equal), GEQ (greater or equal), LS (less), GT (greater). EQ value is used by default if the attribute is not available. |
IsVersion | Indicates whether value is compared as a version. If the attribute is set to True, an attempt to parse the KeyValue value is made. If parsing resulted in an integer or real number or a combination of numbers as a version (for example, 1.0.3), the numbers are compared taking into account the specified Cmp comparison type. If parsing failed, the KeyValue value and registry value are compared for equality. |
The update folder must contain the Microsoft .NET Framework 4.5.2 distribution file (the file NDP452-KB2901907-x86-x64-AllOS-ENU.exe).
<Start Timeout="-1">
<Before>
<File Path="NDP452-KB2901907-x86-x64-AllOS-ENU.exe" Args="/passive /promptrestart /showrmui">
<RegistryCondition KeyPath="SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full" KeyName="Release" Cmp="GEQ" KeyValue="379893" Path=""/>
<RegistryCondition IsDefault="True" />
<OsCondition OsVersion="6.0" ServicePack="2"/>
<OsCondition OsVersion="6.1" ServicePack="1"/>
<OsCondition OsVersion="6.2"/>
<OsCondition OsVersion="6.3"/>
<OsCondition OsVersion="10.0"/>
</File>
</Before>
</Start>
Before installing Foresight Analytics Platform the system checks for the key in the registry:
If the registry contains the entry and the version specified in the entry is later or matches the checked version (Cmp, KeyValue), the distribution file is not started (Path="").
If there is no entry or the entry exists but it contains the version that is earlier than the checked one, the distribution file is started and the installation is started (IsDefault="True").
The file is started only in checked Windows versions:
Windows Server 2008;
Windows 7, Windows Server 2008 R2;
Windows 8, Windows Server 2012;
Windows 8.1, Windows Server 2012 R2;
Windows 10, Windows Server 2016.
Create system environment variables and user environment variables (<Var>)
To determine system environment variables and custom environment variables, create the <Var> section in cfgconfig.xml and determine appropriate attributes.
NOTE. All the system environment variables are added to the custom environment variables.
Attribute | Description |
Name | Determines the name of an environment variable. |
IsUser | Determines whether a variable is custom. Available values: true, false. |
Val | Determines the variable value. |
<Start>
<Before>
<Var Name="var_test" Val="var_val_test" />
</Before>
</Start>
Before updating, the var_test environment variable is created with the var_val_test value.
<Start>
<Before>
<Var Name="var_test" IsUser="true" Val="var_val_test" />
</Before>
</Start>
Before updating, the var_test custom environment variable is created with the var_val_test value.
Install MSI file and get log file (<Log>)
To get a log file on installing the MSI file, create the <Log> chapter in cfgconfig.xml and determine the appropriate attributes.
Attribute | Description |
File | Determines the path to the log file. |
Mode | Determines the type of information to be stored in the log file. The attribute value may contain one or several values. For details see the specialized reference manuals (MSDN). |
Attrs | Determines how often the log clipboard is cleared. For details see the specialized reference manuals (MSDN). |
<Start>
<Log File="C:\ppinstall.log" Mode="Warning|User|Info" Attrs="Append|FlushEachLine" />
</Start>
On updating an update execution log is created.
Determine actions with previously installed releases and checking the file integrity (<Msi>)
Create the <Msi> chapter to determine autoupdate actions with previously installed releases of Prognoz Platform and Foresight Analytics Platform, and to set up integrity of executable files.
Attribute | Description |
RemoveMode | Determines whether to remove the previously installed releases of Prognoz Platform and Foresight Analytics Platform:
|
CheckControlSums | Determines whether each time Foresight Analytics Platform is started the integrity of executable files is checked, and file contents is compared with a standard:
|
<Start>
<Msi RemoveMode="none" CheckControlSums="True"/>
</Start>
All the previously installed releases are kept, and the integrity check is run on the executable files.
To delete a specific release or help system, create the <After> chapter with the <File> subchapter in the cfgconfig.xm file and specify the Path and Args attributes as in the example.
<Start>
<After>
<File Path="msiexec.exe" Args='/qn /x {4B7BC2B5-F02D-4CBE-B177-06DCAA4704F1}' NoDb="1"/>
</After>
<Msi RemoveMode="none" />
</Start>
In this case when update is executed, all previously installed releases will be kept except for the 20th release, which was force removed after updating.
The Args attribute can be determined using various arguments:
Args='/x {<GUID>}' - deletes the specified release or help system.
Args='/qn /x {<GUID>}' - deletes the specified release or help system in quiet mode.
<GUID> is a code of Prognoz Platform or Foresight Analytics Platform for the specific release or help system to be removed. If it is required to get release code, contact technical support by sending a request to support@fsight.ru or using technical support services, which are available after registration on the site.
The following substitutions can be used in attribute values to specify system directories and platform installation directories:
Substitution | Description |
#INSTALLDIR# | Installation directory (path) of Foresight Analytics Platform. For example:
|
#SYSTEM32DIR# | Directory (path) to the system32 system folder. Depending on the bitness of cfge.exe and OS, the #SYSTEM32DIR# substitution returns the following values: |
See also: