PDA

View Full Version : Automated nightly builds with script-based installer?



lonewolf32
09-27-2010, 10:08 AM
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.

RobertDickau
09-27-2010, 05:54 PM
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.

lonewolf32
09-28-2010, 08:19 AM
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.

RobertDickau
09-28-2010, 09:40 AM
Perhaps see if the -d switch to ISCmdBld.exe does what you want?

lonewolf32
09-28-2010, 11:05 AM
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.

RobertDickau
09-28-2010, 05:07 PM
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?

lonewolf32
09-29-2010, 08:30 AM
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!

Kelter
09-29-2010, 02:27 PM
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%.

CodeGuru
11-16-2010, 12:39 AM
Can anyone elaborate on how they're using the automation interface to update the version number?

Thanks.

GarrettDyer
11-16-2010, 09:57 PM
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).