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

Automation Interface: Build method isn't building project

I am unable to get the Build method to run the build for my IS2011 InstallScript project. I can modify Path Variables and Properties in the project prior to running the build without issue, but the Build itself doesn't seem to function. Furthermore, it reports no Errors or Warnings...I can't tell that anything is happening at all.

I'm certain that I've gotten the correct object reference because I'm able to report back the object's Name property (see the output of the "Release name = " print statement). Any help you can lend as to why this project won't build is much appreciated!

sub BuildProject {
my $function = "BuildProject";
my ($sProjectDir, $sProjectName) = @_;

print "\nProjectDir: $sProjectDir\n";
print "Project Name: $sProjectName\n";

my $sISProjectName = "$sProjectDir\\$sProjectName.ism";

print "\nStarting the InstallShield build for $sISProjectName.\n";

my $isProject = Win32::OLE->new("IswiAuto17.ISWiProject");
if (not defined ($isProject)) {
die "\n$function: Failed to set isProject";

# open a project as read-write
my $ret = $isProject->OpenProject($sISProjectName, 1);
if ($ret != 0) {
die qq(\n$function: Could not open InstallShield project!\n);

my $objRelease;
$objRelease = $isProject->ISWiProductConfigs("Media")->ISWiReleases("New Media");
if (not defined ($objRelease)) {
die "\n$function: Failed to set objRelease";

# build it
print "\nRelease name = " . $objRelease->Name . "\n";

# report warnings and errors
print "Warnings: ", $objRelease->BuildWarningCount, "\n",
"Errors: ", $objRelease->BuildErrorCount, "\n";

if ($objRelease->BuildErrorCount > 0) {
print qq(\n$function: Installshield failed to build the project.);
} else {
print "\n$function: The build of the $sProjectName project is complete.\n";

# close the project:

That produces this output:

ProjectDir: C:\BUILD\Core
Project Name: Core

Starting the InstallShield 2011 build for C:\BUILD\Core\Core.ism.

Release name = New Media
Warnings: 0
Errors: 0

BuildProject: The build of the Core project is complete.
Labels (1)
0 Kudos
(5) Replies
Level 17

If you open the project as a writable file by passing 0 to the second parameter of the OpenProject function, does it make any difference?
0 Kudos
Level 6

Similar to what hidenori said... I've had trouble building in the past if the files were in source control...and hence read-only.

Therefore our build script will always check out some of the following files:

Project\Script Files\*.*

Maybe give that a try?
0 Kudos
Level 5

I changed that flag to 0 and still don't get a package. The ISM is modified with the changes to Path Variables and Properties (code that runs prior to this BuildProject function), but I don't have a Media folder in my project folder.

lam: Those "gets" out of source control occur earlier in the automation, as well as a folder-level change of all of the file attributes to read-write.

One thing I forgot to mention: this is the output I get whether the project builds cleanly or not. So, if I intentionally add code that will cause the build to fail, I get no indication that it didn't work. When I remove that code and run the build, I get the same output from the automation.
0 Kudos
Level 17

Try consuming the event from the ISWiRelease object and see if you are getting any status message from the build. Here is a sample VB code:

Public WithEvents pISWiRelease17 As ISWiAuto17.ISWiRelease

Private Sub Command1_Click()
Dim pISWiProject17 As ISWiAuto17.ISWiProject
Set pISWiProject17 = CreateObject("ISWiAuto17.ISWiProject")
pISWiProject17.OpenProject "C:\InstallShield 2011 Projects\My Project Name-1.ism", False
Set pISWiRelease17 = pISWiProject17.ISWiProductConfigs("Product Configuration 1").ISWiReleases("Release 1")
Set pISWiProject17 = Nothing
End Sub

Private Sub pISWiRelease17_StatusMessage(ByVal sMessage As String, pbCancel As Boolean)
End Sub
0 Kudos
Level 5

hidenori wrote:
Try consuming the event from the ISWiRelease object and see if you are getting any status message from the build.

I didn't go this far, but I used your VB code to write a build routine for vbscript and it works as expected. So that tells me the COM object is alive and well. (EDIT: If you want to walk me through how to construct the VB executable, I'm all ears...I have no experience with it.)

Additional info:
I tested my Perl build using a 2010 project, and it built correctly (reporting 2 warnings).
I then added code to make it fail and it correctly reported 1 failure and 2 warnings.
I then upgraded the project to 2011 and the build didn't work (and didn't report build errors and warnings).

This just doesn't make sense.
0 Kudos