Defining installation-parameters

Starting with version 3.1 of the Packaging PowerBench, it is possible to define installation-parameters in the Package.xml of a package, which can be passed to the package via the calling command line. This allows you to set the value of variables used in the package externally at runtime, making packages more customized and flexible for different environments and constraints.

When you create a new package with the new PPB version, you will find the (empty) "Parameters" section in the Package.xml:

  <Parameters />

To define parameters, add the required parameters to this section. The value of the respective parameter is the default value that the variable created from it receives if you do not specify it via command line:

  <Parameters>
      <Parameter Name="Licensekey">111-1111111</Parameter>
      <Parameter Name="Companyname">MyOwnCompany</Parameter>
  </Parameters>

Variables are automatically defined for each parameter, which you can then use in your script. The variable format is ${InstallationParameters.<name of parameter>}, so in the example above, the two variables ${InstallationParameters.Licensekey} and ${InstallationParameters.Companyname} are defined. The variables are also suggested to you in the variable drop-down list when used in the Packaging PowerBench dialogs, as usual.

To pass a value to the parameters on the command line, call deploy-application.exe with the -InstallationParameters parameter and specify the values you want to pass in the format <parameter name>=value. So if you want to override (only) the company name in the example, call the package like this:

deploy-application.exe -InstallationParameters Companyname=BigCorp

If the value of the parameter contains spaces (which e.g. would not be unusual with a company name or directory paths), then on the one hand everything after InstallationParameters must be enclosed in double quotes and furthermore the value(s) with the space must also be encapsulated in single quotes:

deploy-application.exe -InstallationParameters "Companyname='NWC Services GmbH'"

If more than one parameter value is to be passed, the individual parameters must be separated by commas. An (optional) space can be inserted after the commas:

deploy-application.exe -InstallationParameters "Licensekey=123-1234567, Companyname='NWC Services GmbH'"