I am trying to use the application version that I pass in using --setvars and set to the project.version of the build script. The variable is known when creating the installer, because the filename contains the version I passed in with --setvars for the outdir. The issue is that when I go to run the installer on the user machine, the variable is unknown for some reason. Is there an explicit method for persisting this version information so that upon installation, I can reuse this variable?

Example:

Command Line:

"C:\Program Files (x86)\BitRock InstallBuilder Enterprise 8.0.2\bin"\builder-cli.exe build "C:\Build\Build_Mainline\Setup\SCS Communicator"\Communicator.xml windows --verbose --setvars app_version=${env(APP_VERSION)} BuildDir=C:\Build\Build_Mainline\

project.xml:

<project>
 ...
    <version>${app_version}</version>
 ...
 <postInstallationActionList>
 <runProgram>
                    <program>ServiceConfigswitch.exe</program>
                    <programArguments>-F "${installdir}\StonewedgeCONNECT.exe" -V ${project.version}</programArguments>
                    <runAs>Administrator</runAs>
                    <workingDirectory>${installdir}</workingDirectory>
 </runProgram>
 </postInstallationActionList>
 ...
 <outputDirectory>../../../Build_Local_Depot/Operations/Pre-Release_Software/Stonewedge Connect/CONNECT_${project.version}</outputDirectory>

Output:

 [PATH]/CONNECT_0.0.0.5/CONNECT-0.0.0.5-windows-installer.exe

But when I run it on the user system, I get the following error from the bitrock_installer.log:

 Executing ServiceConfigswitch.exe -F "C:\Program Files (x86)\Stonewedge Corporation\StonewedgeCONNECT\StonewedgeCONNECT.exe" -V ***unknown variable app_version***

Any help would be appreciated.

asked 14 Jun '12, 15:10

phoey's gravatar image

phoey
1112
accept rate: 0%


Variables defined at build-time are not available at run-time. The usual solution for this is to define a hidden parameter:

<project> 
  ...
  <parameterList>
    <stringParameter name="app_version" value="" ask="0"/>
  </parameterLis>
  ...
</project>

But in your case, as you are just using the variable to configure a project setting, you could just configure it directly:

builder-cli.exe build Communicator.xml windows ... --setvars project.version=${env(APP_VERSION)} ...
link

answered 14 Jun '12, 16:45

juanjo's gravatar image

juanjo ♦♦
5.8k413
accept rate: 23%

Thank you for the reply.

I am still unable to get the version information (after using the --setvars) at install time. (Installer Version: 8.0.2 (2012-01-24))

I tried setting the version tag with and without the passed in value, but both results in an empty "project.version" variable when I go to run the postinstall step.

Results:

Executing ServiceConfigswitch.exe -F "C:\Program Files (x86)\Stonewedge Corporation\StonewedgeCONNECT\StonewedgeCONNECT.exe" -V

The version for the -V parameter is empty.

(14 Jun '12, 18:19) phoey
1

Sorry, I just realized you are passing the variable through command line as ${env(APP_VERSION)}. That is an InstallBuilder notation and won't work in the command line. If APP_VERSION is defined as an environment variable, the proper way of calling the builder would be:

builder-cli.exe build Communicator.xml windows ... --setvars project.version=%APP_VERSION% ...

(15 Jun '12, 03:14) juanjo ♦♦

Yes, that was it! Thank you very much for your help!

(15 Jun '12, 09:00) phoey
Your answer
toggle preview

Follow this question

By Email:

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

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "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

Tags:

×40
×26
×18

Asked: 14 Jun '12, 15:10

Seen: 1,842 times

Last updated: 15 Jun '12, 09:00