Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
InstallShield Automation With C#
Message
De
03/06/2003 13:06:55
 
 
À
03/06/2003 12:39:24
Information générale
Forum:
ASP.NET
Catégorie:
Migration
Divers
Thread ID:
00795693
Message ID:
00795790
Vues:
227
UPDATE:
Discovered that eventhough referencing a ProductConfig or Release by it's name is valid in the IDE (and compilation), apparently only by the index number is valid at runtime. Strange.

Guess we'll have to foreach though the ProductConfigs and Releases to grab a specific one by name.


-----
Of course, I spoke too soon since I'm getting a:
An unhandled exception of type 'System.IndexOutOfRangeException' occurred
Additional information: Item not found
    > ISWiAutomation.ISWiProductConfigs.Item...
When the following executes at runtime:
oProdConfig = (ISWiProductConfig) oISProj.ISWiProductConfigs["Default"];
The following cleaned up version which complies and runs:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.IO;
using ISWiAutomation;

<snip>

private void frmMain_BuildISProj()
{
   if ( txtProjectFile.Text != "" )
   {
	string	strProjectFile;

	strProjectFile = txtProjectFile.Text.Trim();

	// Create IS object and open project file
	ISWiProjectClass oISProj = new ISWiProjectClass();
	oISProj.OpenProject(strProjectFile, false);

	//-- Build release
	ISWiProductConfig oProdConfig;
	ISWiRelease oRelease;

	//-- We only have one Product Configuration and it's named "Default"
        oProdConfig = (ISWiProductConfig) oISProj.ISWiProductConfigs[1];

	for ( int i = 1; i <= oISProj.ISWiProductConfigs.Count; i++ )
	{
	    if (oISProj.ISWiProductConfigs[i].Name == "Default")
	    {
		oProdConfig = oISProj.ISWiProductConfigs[i];
	    }
	}
	
	//-- We only have one Release and it's named "Network"
        oRelease = (ISWiRelease) oProdConfig.ISWiReleases[1];

	for ( int i = 1; i <= oProdConfig.ISWiReleases.Count; i++ )
	{
	    if (oProdConfig.ISWiReleases[i].Name == "Network")
	    {
		oRelease = oProdConfig.ISWiReleases[i];
	    }
	}
	
        oRelease.Build();
	
	// Other option?:
	// oISProj.ISWiProductConfigs[1].ISWiReleases[1].Build();
	
	oISProj.SaveProject();
	oISProj.CloseProject();

	oISProj = null;
	oProdConfig = null;
	oRelease = null;

   }  // txtProjectFile.Text != "" 

}  // frmMain_BuildISProj()


VFP6 SP5, VFP8 SP1, VFP 9 SP 1 and Win XP SP 3 (unless otherwise specified)


www.wulfsden.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform