My installer has a parameter that can be set on the command line. (Actually, the parameter belongs to a component, but I don't think that is important.)

<booleanParameter name="paramname">

In this case, the parameter can not be edited by the user during install. Here's an example of the use of the parameter:

myinstaller.exe --paramname true

In the pre-install phase, the value of this parameter is available.

    <text>during pre-install: paramname = ${paramname}</text>

[ during pre-install: paramname = true ]

However, I would also like to be able to access the value earlier, during initialisation:

    <text>during init: paramname = ${paramname}</text>

Unfortunately, the parameter has not yet been initialised:

[ during init: paramname = false ]

Is there any way I can access the value as given on the command line?

(With a user-editable parameter, the value as given on the command line might not be the same as that specified by the user, and so in that case I would not expect ${paramname} to necessarily have the same value in the initializationActionList and the preInstallationActionList.)


asked 19 Jan '12, 09:23

Rhubbarb's gravatar image

accept rate: 0%


Could you provide us with more details about what are you trying to accomplish? The main difference between the initialization and the preInstallation is the parsing of the arguments so you could just move all your code to the preInstallation.

(19 Jan '12, 09:30) juanjo ♦♦

Your suggestion of moving the code works fine in this case. Thanks. (I am trying to perform some pre-installation checks. If certain conditions are not met, the installer aborts. However, there is a --force parameter that can be used to circumvent these checks. I'd like these checks to occur very early, preferably before any user input. On the other hand, I'd like to keep the code with the file corresponding to the component in question.)

(19 Jan '12, 09:57) Rhubbarb

There is one 'gotcha' here: I would also like to be able to affect settings such as ${project.installationType}. I think that sort of code really needs to remain in the initializationActionList, and with that, I'm stuck.

(19 Jan '12, 10:13) Rhubbarb

The installationType is just considered later in the installation. The only drawback I can see in moving the code is that the language selection dialog is displayed after the initializationActionList so your checks would be executed after that.

Another possible solution without having to move the code would be to just do the checks but do not abort, just define a: "checks_failed" boolean variable (or a variable containing a list of errors) and in the preInstallationActionlist, just include:

   <throwError text="The machine did not pass the validations">
           <isFalse value="${force}"/>
           <isTrue value="${checks_failed}"/>

answered 19 Jan '12, 11:53

juanjo's gravatar image

juanjo ♦♦
accept rate: 23%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: 19 Jan '12, 09:23

Seen: 1,377 times

Last updated: 19 Jan '12, 11:53