cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
lonewolf32
Level 5

Automated nightly builds with script-based installer?

Is this possible?

We have complex (Installshield 2010-2011) script-based installers that also invoke other installshield object projects (both homemade and provided by IS). We use batch files to get source code and build our visual studio projects, but right now when we do the Installshield part we strictly use the GUI because we want to make sure there were no errors, but also because we need to update the build number every time. As far as I know there is no batch or automated way to do this.

Can anyone suggest a way to do nightly automated builds in this scenario? I would really love to kick off nightly builds at 3 AM or whatever, even if I had to use a batch file.

Thanks.
Labels (1)
0 Kudos
(9) Replies
RobertDickau
Flexera Alumni

Yes, you can use ISCmdBld.exe to do command-line builds and set your product version, or instead/also use the InstallShield automation interface to do those things (and more sophisticated processing). The InstallShield help library has more information on both approaches.
0 Kudos
lonewolf32
Level 5

Thanks! One oddball question though. Installshield's product version doesn't exactly mesh with our own version scheme so in addition to product version present in the GUI (under General Information) we store a separate product version and build number as a define in the script.

An example would be:
Product Version: 1.12.0007

Our defines:
PRODUCT_VERSION = 1.1200
PRODUCT_BUILD = 7

You might say to read in product version and parse it... but they do not always line up due to alpha or beta releases etc.

Is there a way to communicate a new version and build number to my script? Perhaps there is a way to create custom system variables and set them?

Thanks.
0 Kudos
RobertDickau
Flexera Alumni

Perhaps see if the -d switch to ISCmdBld.exe does what you want?
0 Kudos
lonewolf32
Level 5

I don't think I can use preprocessor directives. I would need to use my custom defines to say, create a registry entry with that value.
0 Kudos
RobertDickau
Flexera Alumni

My mistake, I thought that's what you meant by "defines" in your script. I don't know if there's a way to change variables (without editing the script as a text file before compiling); perhaps use the automation interface to set a string table entry with your values?
0 Kudos
lonewolf32
Level 5

I am looking at the Automation Interface. This is most likely the route I would have to take. A little disappointed that its a COM interface, but C# can deal with that. Also I am a bit surprised there is not a top-to-bottom sample of this (for VB6 or whatever) in the Help files to at least get you started.

But aside from that, I think I've got my answer. Thanks!
0 Kudos
Kelter
Level 10

we include this line in our build script

echo #define BUILDNUM "%BUILD_LABEL%" > "%BUILD_DIR%\Install\Script Files\buildnum.h"

An InstallScript CA calls
MsiSetProperty( hMSI, "BUILDNUMBER", BUILDNUM );

Obviously our build script sets %BUILD_LABEL%.
0 Kudos
CodeGuru
Level 4

Can anyone elaborate on how they're using the automation interface to update the version number?

Thanks.
0 Kudos
GarrettDyer
Level 5

CodeGuru wrote:
Can anyone elaborate on how they're using the automation interface to update the version number?


Here is a direct route via Perl script:

sub UpdateIS2010ProductVersion {
my ($projectPath, $projectName, $projectVersion) = @_;
my $projectFile = File::Spec->catfile($projectPath, $projectName . ".ism");

print "\nUpdating Product Version for $projectFile to $projectVersion\n";

# instantiate the Developer Automation interface
my $isDAI = Win32::OLE->new("IswiAuto16.ISWiProject");

# open a project as read-write
my $res = $isDAI->OpenProject($projectFile, 0);
if ( $res != 0 ) {
die qq(\nERROR: Could not open Installshield project.);
}

#Change the Version
$isDAI->SetProperty("ProductVersion", $projectVersion);

$isDAI->SaveProject( );
$isDAI->CloseProject( );

# clean up
undef $isDAI;
}


Alternatively, here's a more generic function that allows you to update any property:

#-------------------------------------------------------------------------------
# Description: Update a Property in an InstallShield project.
# Inputs : Path to the ISM file
# File Name without .ism
# Property to be updated
# Value to be inserted into the Property
# InstallShield project version
#-------------------------------------------------------------------------------
sub UpdateProperty {
my $function = "UpdateProperty";
my ($projectPath, $projectName, $PropertyName, $PropertyValue, $sISver) = @_;
my $projectFile = File::Spec->catfile( $projectPath, $projectName . ".ism" );

print "\nUpdating the $PropertyName Property for $projectFile to $PropertyValue\n";

my $isProject;
if ($sISver eq "12") {
$isProject = Win32::OLE->new("IswiAuto12.ISWiProject");
} elsif ($sISver eq "10.5") {
$isProject = Win32::OLE->new("IswiAuto1050.ISWiProject");
} elsif ($sISver eq "2010") {
$isProject = Win32::OLE->new("IswiAuto16.ISWiProject");
} elsif ($sISver eq "2011") {
$isProject = Win32::OLE->new("IswiAuto17.ISWiProject");
} else {
die ("$function: InstallShield version wasn't passed!");
}

# open a project as read-write
my $res = $isProject->OpenProject($projectFile, 0);
if ($res != 0) {
die qq(\n$function: Could not open Installshield project!\n);
}

# Change the Property's value:
$isProject->SetProperty($PropertyName, $PropertyValue);

$isProject->SaveProject();
$isProject->CloseProject();

# clean up
undef $isProject;
}


Disclaimer: I haven't used these functions with IS versions older than IS2010. I left the older versions there as information...they might not work (I don't seem to be able to update Path Variables in 10.5 projects this way, for instance).
0 Kudos