Working with Advanced Installer from the Command Line

The Advanced Installer command line allows you to create, build or edit projects without using the graphical interface.

NoteWhen calling Advanced Installer from command line you must use the AdvancedInstaller.com tool. This tool is located in the following folder:
C:\Program Files (x86)\Caphyon\Advanced Installer 16.7\bin\x86, if Advanced Installer's installation folder is C:\Program Files (x86).

1. Creating a new project

The new project command line syntax is:

<path>AdvancedInstaller.com /newproject <project_file_path>
  { [-type <project_type>] [-lang <project_language>] }  

Parameters:

  • <path>
  • Path to Advanced Installer executable.
  • <project_file_path>
  • Path to project file (e.g. "C:\Users\Caphyon\Desktop\Advanced Installer\project.aip"). This parameter's value must point to an existing full path, otherwise the operation will fail.
  • -type <project_type>
  • Specify the project type.
    • <project_type>
    • The project type. The string can be either of the available project type names in Advanced Installer: professional, , enterprise, architect, patch, msm, update, win-ce, vsix. For the "Simple" project type you must omit the -type switch (e.g. AdvancedInstaller.com /newproject simpleProject.aip)
  • -lang <project_language>
  • Specify the project language.
    • <project_language>
    • The project language (e.g. "en" for English, "ru" for Russian, etc.).
  • -overwrite
  • Include this parameter to silently overwrite any existing project with the same name from the specified location. If this parameter is not specified and a project with the same name already exists, an exception will be thrown.
  • -template <template_name>
  • Specify the existing template used for creating the new project.
    • <template_name>
    • The template name. The string must be the name of one of your saved custom templates from Advanced Installer Start Page.

ImportantThe -template parameter is incompatible with -type and -lang parameters

ImportantThe order of the parameters in a command line syntax must be respected. If the parameters are written in any other order, the obtained result will not be the one intended.

2. Building from command line

In order to build an MSI from command line, you can use the following syntax:

AdvancedInstaller.com /build <project_file_path>
  { [-buildslist <builds_list>] | [-configurationslist <configurations_list>] }

Parameters:

  • <path>
  • Path to Advanced Installer executable.
  • <project_file_path>
  • Path to project file.
  • -buildslist <builds_list>
  • Perform a set of builds. All builds are performed if no build is specified.
    • <builds_list>
    • list of builds that should be performed; build names should be separated by semicolon (";") characters
  • -configurationslist <configurations_list>
  • Build a set of configurations. For WinCE projects only. All configurations are build if no configuration is specified.
    • <configurations_list>
    • list of configurations to build; configuration names should be separated by semicolon (";") characters

2.1 Performing a clean Rebuild

In order to build the project regardless whether the project was modified and without using any cached files, you can use the following syntax:

AdvancedInstaller.com /rebuild [project_file_path]
  { [-buildslist <builds_list>] | [-configurationslist <configurations_list>] }

3. Return codes

For a list of Advanced Installer's command line error return codes, please follow Command line return codes article.

4. ANT integration

In order to include Advanced Installer in an ANT build you can add the following target to your build.xml file:

<target name="advinst">

<exec executable="[path]\AdvancedInstaller.com">
    <arg line="/build [project].aip"/>
  </exec>

</target>

5. Load Custom Path Variables

Load a list of Path variables to be further used by Advanced Installer.

AdvancedInstaller.com /loadpathvars <path_variables_file_path>
  • <path_variables_file_path>
  • Loads a new set of path variables from the specified file (XML file).

In order to create an XML file containing your custom path variables you must first create the path variables and use "Save To..." Operation available in Global Path Variables Tab.

6. Executing a file of commands

You can specify a text file containing a series of edit commands that will be executed in sequence.

In order to execute a file of commands you can use the following syntax:

AdvancedInstaller.com /execute <path_to_project_file> <command_file_path> [-nofail]

Parameters

  • <path_to_project_file>
  • Path of the project to edit.
  • <command_file_path>
  • Path of the commands file.
  • -nofail
  • Display all the errors but do not interrupt the execution of the commands file.

When creating a file of commands there are some rules that must be taken into consideration:

  • The first line of the file must be ;aic
  • One of the following encodings must be used:
    • ANSI
    • Unicode
    • UTF-8

ImportantThe byte order mark (BOM) is required when UTF-8 and Unicode are used.

ImportantIf the you want to use special characters like for example "a, ä, o, ö, u, ü, s, ß, %" the .AIC file should be saved using the "UCS2 LE BOM" encoding.

Apart from the usual edit commands, inside the commands file you can use the following command options:

SaveSaves the project.
BuildBuilds the project.
RebuildPerforms a clean rebuild of the project.
ResetSigResets the digital signature. The effect of this command is equivalent to unticking the option “Enable signing” in the Digital Signature page. This is useful for instance in release candidate builds when signing the package and/or installation files is not required.
SetSigOpposite for command ResetSig. The effect of this command is equivalent to ticking the option “Enable signing” in the Digital Signature page.

NoteTo point the location for your files you can also use environment variables, using the separator “%“, like we use for the variable “SAMPLE“ in our example. If your environment variable contains a path with whitespaces then you should use quotes for the entire path.

6.1 Example

;aic
SetVersion 1.2
AddFile APPDIR\MyFolder C:\Folder\File.txt
AddFile APPDIR\MyFolder “%SAMPLE%File.txt“
SetProperty TESTPROP="TestValue"
Save
Rebuild

NoteThe project will not be modified by the edit commands specified in an AIC file. The Save command must be used explicitly in order to persist the project state after a sequence of edit commands (if this is desired).

7. Convert MSI to virtualized package

Using the Architect edition you can create virtualized packages (AppV 4.x, AppV 5.x and ThinApp) from MSI packages not created with Advanced Installer. This can be scripted so everything is done automatically, as in the following commands file example:

;aic
SetOutputLocation -buildname "BuildAppV5" -path "C:\Work\Virtualized Packages\SamplePackage"
Build -buildslist "BuildAppV5"
      

To execute this command file you would call the following:

AdvancedInstaller.com /execute <path_to_MSI_file> <command_file_path>

In the sample from above you see the command ”SetOutputLocation” used to set the folder where you want the virtualized package to be generated, and the command ”Build” used to trigger the build operation of the virtualized page. For both commands you should use only one of the following three build names:

  • BuildAppV5 - trigers the conversion of the MSI to an AppV 5.x package
  • BuildAppV4 - trigers the conversion of the MSI to an AppV 4.x package
  • BuildThinApp - trigers the conversion of the MSI to a ThinApp package

8. Run the installer in a virtual machine

In order to test the installer in a virtual machine, you can use the following syntax:

AdvancedInstaller.com /RunInVM <project_file_path>
   [-build name] -vmprofile {GUID} [-quiet]

Parameters:

  • <path>
  • Path to Advanced Installer executable.
  • <project_file_path>
  • Path to project file.
  • -build name
  • Optional parameter used to launch a specified build for testing. If this switch is not specified, the default build will be launched for testing.
  • -vmprofile {GUID}
  • The unique identification number for the profile. Chek the profile GUID in the VM Profile Options.
  • -quiet
  • The VM Launcher dialog is not displayed.

9. Register Advanced Installer using the command line

To activate Advanced Installer you can use the following syntax:

AdvancedInstaller.com /register <license_id>
  • <license_id>
  • The license ID which you received after purchasing Advanced Installer.

When there's no Internet connection, the following option applies:

AdvancedInstaller.com /RegisterOffline <file_path>
  • <file_path>
  • The path of the license file you received from support.

To register with a floating license the syntax is:

AdvancedInstaller.com /registerfloating <host>:<port> [-testconnection]
  • <host>
  • The license server host name.
  • <port>
  • The license server port number.
  • [-testconnection]
  • If this parameter is provided, the connection with the license server is tested. If a license slot is available the return code is 0. If no license slot is available or other error occurs (eg. a network problem), the return code is AI_ERROR_NO_FLOATING_LICENSE (0xE001006D). If this parameter is not provided, the return code is 0.

Optionally, with a floating license, you can use a proxy server to connect through. The syntax is:

AdvancedInstaller.com /cfglicensesrvproxy [-set <host>:<port>] | [-disable]
  • -set <host>:<port>
  • Set a proxy server to connect through.
    • <host>
    • The proxy server host name.
    • <port>
    • The proxy server port number.
  • -disable
  • Disable connecting through the proxy server.

10. Setting the Repository path

To set the Repository path you can use the following syntax:

AdvancedInstaller.com /SetRepositoryPath <path> [-move]

Parameters:

  • <path>
  • The new path on disk of the Repository. When used without the -move switch it changes the location without moving the existing Repository resources to the new location.
  • -move
  • When used it changes the location and moves the existing Repository resources replacing the identical ones.

11. Getting the Repository path

To get the Repository path you can use the following syntax:

AdvancedInstaller.com /GetRepositoryPath

12. Displaying the command line help

Use the following syntax to display the usage for the available command line options:

AdvancedInstaller.com { /help | /? } [<command>]

13. Refresh synchronized folders

Use the following syntax to refresh the synchronized folders in your project:

AdvancedInstaller.com /edit <project_file_path> /RefreshSync [<target_folder_path>]

14. Change the package output type

To change the package type from command-line use the following syntax:

AdvancedInstaller.com /edit <project_file_path> /SetOutputType <packageType> [-buildname <build_name>] [-msi_url <msi_url>] 

Package types: MsiInside, MsiOutside, ExeInside, ExeOutside, and WebInstaller

-buildname is optional, if not specified, the command applies to the current build

-msi_url is required only for the WebInstaller package type

Example:

"C:\ai\win\Debug\bin\x86\AdvancedInstaller.com" /edit "Your Application.aip" /SetOutputType WebInstaller -buildname MsiBuild -msi_url "http://www.example.com"

15. Set digital certificate file and password

To set the digital certificate file use the following syntax:

AdvancedInstaller.com /edit <project_file_path> /SetDigitalCertificateFile [-file <certificate_path>] [-password <certificate_password>] [-enable_signing]

Parameters:

  • <certificate_path>
  • The full path of the digital certificate file, for example: "c:\test\test_certificate.pfx"
  • <certificate_password>
  • The password associated with the digital certificate
  • -enable_signing
  • Enable the actual signing

To change the digital certificate password use the following syntax:

AdvancedInstaller.com /edit <project_file_path> /SetDigitalCertificatePassword [-password <certificate_password>]

Parameters:

  • <certificate_password>
  • The password associated with the digital certificate

16. Set Azure Key Vault parameters

To set the Azure Ket Vault parameters use the following syntax:

AdvancedInstaller.com /edit <project_file_path> /SetAzureKeyVaultParameters [-tenant_id <tenant_id>] [-app_id <app_id>] [-vault_name <vault_name>] [-certificate_name <certificate_name>] [-certificate_version <certificate_version>] [-enable_signing]

Parameters:

  • <tenant_id>
  • Specify the Azure Tenant ID
  • <app_id>
  • Specify the Azure App ID
  • <vault_name>
  • Specify the Azure Vault Name
  • <certificate_name>
  • The name of the digital certificate file.
  • <certificate_version>
  • The version of the digital certificate.
  • -enable_signing
  • Enable the actual signing

Topics

  • Return codes
    The list of return codes for Advanced Installer command line operations.
  • Editing
    How to edit Advanced Installer projects with command line commands.