Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
InstallShield Automation With C#
Message
De
03/06/2003 11:11:02
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Migration
Titre:
InstallShield Automation With C#
Divers
Thread ID:
00795693
Message ID:
00795693
Vues:
850
Hi all,

One method I'm using to learn C# is transposing similar code or tasks that I've done in VFP. Well here is part of a routine to automate InstallShield Developer 8. I have been running in circles trying to get it to work in C#, but the ProdConfigs and Releases collections seem to be viewed very differently by C#. Can anyone offer any guidance?

Thanks,

- Brian

Notes: ISWiAutomation is the reference added to the solution for the InstallShield Developer COM dll. Intellisense works fine for oISProj below...


In C#:
---------
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 SMART2o project file
	ISWiProjectClass oISProj = new ISWiProjectClass();
	oISProj.OpenProject(strProjectFile, false);


	//-- Build release
	ISWiProductConfigs oProdConfig;
	ISWiReleases oRelease;

	//-- We only have one Product Configuration and it's named "Default"
	// *** None of the following work
	oProdConfig = oISProj.ISWiProductConfigs.Item("Default"); // compiler reports no definition for 'Item'
	oProdConfig = (ISWiAutomation.ISWiProductConfigs) oISProj.ISWiProductConfigs.Item("Default"); // compiler reports no definition for 'Item'
	oProdConfig = (ISWiAutomation.ISWiProductConfigs) (oISProj.ISWiProductConfigs).Item("Default");
	

	// *** The following is from the VS debugger "Watching" oProdConfig... going insane...
	// ((ISWiAutomation.ISWiProductConfigsClass)(((ISWiAutomation.ISWiProductConfigs)(oISProj.ISWiProductConfigs)))).Item("Default");

	// This works at runtime, but compiler doesn't like it...
	oProdConfig = ((ISWiAutomation.ISWiProductConfigsClass)(((ISWiAutomation.ISWiProductConfigs)(oISProj.ISWiProductConfigs)))).Item("Default");


	//-- We only have one Release and it's named "Network"
	// *** Nothing works when trying to get the Releases object
	oRelease = oProdConfig.ISWiReleases.Item("Network");  // compiler reports no definition for 'Item'
	oRelease = (ISWiReleases) oISProj.ISWiProductConfigs("Default").ISWiReleases("Network");

	// *** Trying to mimic format displayed by debugger for oProdConfig
	//oRelease = ((ISWiAutomation.ISWiReleases)(((ISWiAutomation.ISWiReleases)(oProdConfig.ISWiReleases)))).Item("Network");


	//oRelease.Build();

	//oISProj.SaveProject();

	oISProj.CloseProject();
   }
}
All is well in VFPLand:
--------------------------
<snip>

LOCAL lcProjFile as String, ;
        oISProj as "ISWiAutomation.ISWiProject"


*-- Get full path and filename of SMART2.o IS project
lcProjFile = "C:\test\mySetup.ism"


*-- Create IS object and open SMART2o project file
oISProj = CreateObject("ISWiAutomation.ISWiProject")
oISProj.OpenProject( lcProjFile )


*-- Build release
LOCAL loProdConfig As ISWiProductConfig
LOCAL loRelease As ISWiRelease

*-- We only have one Product Configuration which is named Default
loProdConfig = oISProj.ISWiProductConfigs.Item("Default")

*-- We only have one Release which is named Network
loRelease = loProdConfig.ISWiReleases.Item("Network")

loRelease.Build
oISProj.SaveProject

oISProj.CloseProject

<snip>
Can even do it with VBScript:
-----------------------------
<snip>

Dim oISProj
Dim strProjFile

strISMFile = "c:\test\mySetup.ism"

' Create IS object and open project file
Set oISProj = CreateObject("ISWiAutomation.ISWiProject")

oISProj.OpenProject strProjFile


'-- Build release
Dim oProdConfig
Dim oRelease

'-- We only have one Product Configuration and it's named Default
Set oProdConfig = oISProj.ISWiProductConfigs.Item("Default")

'-- We only have one Release and it's named Network
Set oRelease = oProdConfig.ISWiReleases.Item("Network")

oRelease.Build

oISProj.SaveProject

oISProj.CloseProject

<snip>


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


www.wulfsden.com
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform