Hi,
I wanted to know how to call a C# dll using Installscript in InstallShield Developer 8.
Thanx In Advance
This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.

C# dll in Installscript
Started by
hiren_5kin
, Nov 11 2006 08:22
3 replies to this topic
Posted 12 November 2006 - 06:00
Using developer 8 would be very difficult. Two approaches that I can think of:
1) Derive the C# class from the Installer class and then manually wire your custom actions using InstallUtil. Not really reccommended
2) Use COM Interop to create the C# class using CoCreateObject() in InstallScript or CreateObject in a script CA ( VB/J). This is problematic in that you must first install and register the interop before you can invoke it.
If you can manage to upgrade to InstallShield 12 life gets ALOT easier as discussed in several of my blog articles. You simply set your assembly to be COMVisible(true), drop it in your SUPPORTDIR and use CoCreateObjectDotNet() in InstallScript to instantiate your class. No installation or registration of the COM is required.
1) Derive the C# class from the Installer class and then manually wire your custom actions using InstallUtil. Not really reccommended
2) Use COM Interop to create the C# class using CoCreateObject() in InstallScript or CreateObject in a script CA ( VB/J). This is problematic in that you must first install and register the interop before you can invoke it.
If you can manage to upgrade to InstallShield 12 life gets ALOT easier as discussed in several of my blog articles. You simply set your assembly to be COMVisible(true), drop it in your SUPPORTDIR and use CoCreateObjectDotNet() in InstallScript to instantiate your class. No installation or registration of the COM is required.
Christopher Painter, MCSE
Author of:
DeploymentEngineering.com
MSI Factory Provider for ADO.NET 2.0 (Work In Progress)
99 Bottles Of Beer - Windows Installer
PM for personal communication only. Please ask questions in the forums.
Author of:
DeploymentEngineering.com
MSI Factory Provider for ADO.NET 2.0 (Work In Progress)
99 Bottles Of Beer - Windows Installer
PM for personal communication only. Please ask questions in the forums.
Posted 13 November 2006 - 10:10
Thanx very much
Can you give me the example of the 2) part it would be really helpfull
Thanx
Can you give me the example of the 2) part it would be really helpfull
Thanx
Posted 09 July 2007 - 08:34
prototype STRING Edusmconn.GetSMData(BYREF STRING, BYREF STRING, BYREF STRING);
// in some event handler onbegin or onfirstuiafter stc.
// create object of class (assemblyname,classname)
try
szDll = SystemFolder^"Edusmconn.dll";
szClass = "Scoremore.Edusmconn";
set oConn = CoCreateObjectDotNet(szDll, szClass);
if (!IsObject(oConn)) then
MessageBox("Object Creation Failed",SEVERE);
endif;
catch
nErr = Err.Number;
szError = Err.Source;
NumToStr(szErr, nErr);
MessageBox(szError + " Failed EdusmConn", SEVERE);
EndDialog(szDlg);
ReleaseDialog(szDlg);
abort;
endcatch;
sResult = oConn.GetSMData(szTemp, szPSeed, szURL);
// call the method by .NETobject.Methodname
// in some event handler onbegin or onfirstuiafter stc.
// create object of class (assemblyname,classname)
try
szDll = SystemFolder^"Edusmconn.dll";
szClass = "Scoremore.Edusmconn";
set oConn = CoCreateObjectDotNet(szDll, szClass);
if (!IsObject(oConn)) then
MessageBox("Object Creation Failed",SEVERE);
endif;
catch
nErr = Err.Number;
szError = Err.Source;
NumToStr(szErr, nErr);
MessageBox(szError + " Failed EdusmConn", SEVERE);
EndDialog(szDlg);
ReleaseDialog(szDlg);
abort;
endcatch;
sResult = oConn.GetSMData(szTemp, szPSeed, szURL);
// call the method by .NETobject.Methodname