Loading
Using a .NET DLL in InstallShield
I've done a few google searches, but I cannot find a definitive answer on how exactly the DLL should be written (whether to enable ComVisible or use System.Runtime.InteropServices, etc), nor how exactly to create the object. All help would be greatly appreciated, thanks!

  • Are you talking about an installer DLL or writing custom actions in .NET?

     

    With an installer DLL you need to inherit from the System.Configuration.Installer class and configure the component to use the class.

     

    If you're writing custom actions in .NET you need to write your DLL in C++/CLI (.NET 2.0) or MC++ (.NET 1.1) so that you can export functions. Note that Microsoft states that .NET custom action DLL's are not supported but there are several people on this forum that have done it successfully.
    Expand Post
  • how do you go about creating and using a dll for the install process to use.

     

    I have a scenerio where I need to query a database and return 2 pieces of information to install shield and add say check box items to a dialog then based on what is checked have that dialog use another dll that will run another script and return maybe 5 pieces of information to installshield and then the installer could walk through like normal. Is this possible.
    Expand Post
  • Yes this is similar to what I am wanting. Ok I am new to installshield and C so i did the dll and it compiles fine, then followed the steps in a new installscript/msi project loaded my new dll and the ISSQLSRV.dll into the support files, added the scripts to the setup.Rul and changed the build portion of the project, it throws me all kinds of errors. I am using InstallShield2008. Here are the errors.   Compiling... Setup.Rul C:\InstallShield 2008 Projects\SQLTesting\Script Files\Setup.Rul(29) : error C8019: 'set' : expected type declaration C:\InstallShield 2008 Projects\SQLTesting\Script Files\Setup.Rul(29) : error C8022: '=' : comma or semicolon expected C:\InstallShield 2008 Projects\SQLTesting\Script Files\Setup.Rul(29) : error C8008: 'DbConnectionCheck' : identifier expected C:\InstallShield 2008 Projects\SQLTesting\Script Files\Setup.Rul(29) : error C8022: ')' : comma or semicolon expected C:\InstallShield 2008 Projects\SQLTesting\Script Files\Setup.Rul(30) : error C8017: 'nRetVal' : expected typedef (struct) name C:\InstallShield 2008 Projects\SQLTesting\Script Files\Setup.Rul(30) : error C8008: '=' : identifier expected C:\InstallShield 2008 Projects\SQLTesting\Script Files\Setup.Rul(30) : error C8014: 'oObj' : identifier already defined C:\InstallShield 2008 Projects\SQLTesting\Script Files\Setup.Rul(30) : error C8022: '.' : comma or semicolon expected C:\InstallShield 2008 Projects\SQLTesting\Script Files\Setup.Rul(30) : error C8022: ')' : comma or semicolon expected C:\InstallShield 2008 Projects\SQLTesting\Script Files\Setup.Rul(36) : error C8003: 'MyOnSQLLogin' : function has no prototype declaration C:\InstallShield 2008 Projects\SQLTesting\Script Files\Setup.Rul(92) : error C8025: 'mySQLServerSelectLogin' : undefined identifier C:\InstallShield 2008 Projects\SQLTesting\Script Files\Setup.Rul(92) : error C8041: '(' : function type required C:\InstallShield 2008 Projects\SQLTesting\Script Files\Setup.Rul(135) : error C8087: cannot return value from program C:\InstallShield 2008 Projects\SQLTesting\Script Files\Setup.Rul(173) : error C8025: 'MyOnSQLLogin' : undefined identifier C:\InstallShield 2008 Projects\SQLTesting\Script Files\Setup.Rul(173) : error C8041: '(' : function type required C:\InstallShield 2008 Projects\SQLTesting\Script Files\Setup.Rul(243) : error C8016: 'Dlg_ChooseSqlInstances' : undefined label:  Setup.inx - 16 error(s), 0 warning(s) ISDEV : error -4370: There were errors compiling InstallScript  Here is my setup.Rul [CODE] //=========================================================================== // // File Name: Setup.rul // // Description: Blank setup main script file // // Comments: Blank setup is an empty setup project. If you want to // create a new project via. step-by step instructions use the // Project Assistant. // //=========================================================================== // Included header files ---------------------------------------------------- include "ifx.h" // Note: In order to have your InstallScript function executed as a custom // action by the Windows Installer, it must be prototyped as an  // entry-point function. // The keyword export identifies MyFunction() as an entry-point function. // The argument it accepts must be a handle to the Installer database. /* export prototype MyFunction(HWND); */   prototype number DbConnectionCheck.Check(BYREF STRING, BYREF STRING, BYREF STRING, NUMBER); prototype string DbConnectionCheck.GetErr();  set oObj = CoCreateObjectDotNet(SUPPORTDIR ^ "ISSupportSQL.dll", "DbConnectionCheck");  nRetVal = oObj.Check(sServer, sUser, sPassword, bWinAuth);   //--------------------------------------------------------------------------- // OnSQLLogin //--------------------------------------------------------------------------- function number MyOnSQLLogin( nReturn, svTitle, svSubTitle ) string sDLL, sMessage; string sHidden[MAX_PATH]; string sServer[MAX_PATH], sUser[MAX_PATH], sPassword[MAX_PATH], sAuth[10], sDB[MAX_PATH], sTemp[MAX_PATH]; number nResult, nSize, nRetVal; BOOL bWinAuth, bDoneLogin;  string svDatabase, szErrMsg; OBJECT oObj; begin  svDatabase = "";  //First extract runtime dll  sDLL = SUPPORTDIR ^ "ISSQLSRV.DLL";  nResult = StreamFileFromBinary( ISMSI_HANDLE, "ISSQLSRV.DLL", sDLL );  UseDLL( sDLL );  //Get Default Properties  nSize = MAX_PATH;  MsiGetProperty( ISMSI_HANDLE, "IS_SQLSERVER_DIALOG", sTemp, nSize );  if( nSize > 0 ) then  //First add the Password property as a Hidden property  //so no passwords accidentally get logged.  nSize = MAX_PATH;  MsiGetProperty( ISMSI_HANDLE, "MsiHiddenProperties", sHidden, nSize );  if( StrLength( sHidden ) > 0 ) then  sHidden = sHidden + ";" ;  endif;  sHidden = sHidden + "IS_SQLSERVER_PASSWORD";  MsiSetProperty( ISMSI_HANDLE, "MsiHiddenProperties", sHidden );  //Now get Default properties  nSize = MAX_PATH;  MsiGetProperty( ISMSI_HANDLE, "IS_SQLSERVER_SERVER", sServer, nSize );  nSize = MAX_PATH;  MsiGetProperty( ISMSI_HANDLE, "IS_SQLSERVER_USERNAME", sUser, nSize );  nSize = MAX_PATH;  MsiGetProperty( ISMSI_HANDLE, "IS_SQLSERVER_PASSWORD", sPassword, nSize );  nSize = 10;  MsiGetProperty( ISMSI_HANDLE, "IS_SQLSERVER_AUTHENTICATION", sAuth, nSize );  if( sAuth = "1" ) then  bWinAuth = FALSE;  else  bWinAuth = TRUE;  endif;  nSize = MAX_PATH;  MsiGetProperty( ISMSI_HANDLE, "IS_SQLSERVER_DATABASE", sDB, nSize );  //Now we have defaults  bDoneLogin = FALSE;  while( !bDoneLogin )  //Show login dialog  nReturn = mySQLServerSelectLogin( sServer, svDatabase, sUser, sPassword, bWinAuth, svTitle, svSubTitle );  if( nReturn = NEXT ) then  //place results from dialog in Property table  MsiSetProperty( ISMSI_HANDLE, "IS_SQLSERVER_SERVER", sServer );  MsiSetProperty( ISMSI_HANDLE, "IS_SQLSERVER_USERNAME", sUser );  MsiSetProperty( ISMSI_HANDLE, "IS_SQLSERVER_PASSWORD", sPassword );  if( bWinAuth = TRUE ) then  sAuth = "0";  else  sAuth = "1";  endif;  MsiSetProperty( ISMSI_HANDLE, "IS_SQLSERVER_AUTHENTICATION", sAuth );  //test connection  MsiSetProperty( ISMSI_HANDLE, "IS_SQLSERVER_CA_SILENT", "0" );  set oObj = CoCreateObjectDotNet(SUPPORTDIR ^ "ISSupportSQL.dll", "DbConnectionCheck");  nRetVal = oObj.Check(sServer, sUser, sPassword, bWinAuth);  if( nRetVal != 0 ) then   szErrMsg = oObj.GetErr();  MessageBox( szErrMsg, MB_OK );  else  bDoneLogin = TRUE;  endif;  else  //BACK was clicked, so we don't even try  bDoneLogin = TRUE;  endif;  endwhile;    endif;  return nReturn; end;  //--------------------------------------------------------------------------- // OnFirstUIBefore // // The OnFirstUIBefore event is called by the framework when the setup is // running in first install mode. By default this event displays UI allowing // the end user to specify installation parameters. //--------------------------------------------------------------------------- function OnFirstUIBefore()  NUMBER nResult, nSetupType, nvSize, nUser;  STRING szTitle, szMsg, szQuestion, svName, svCompany, szFile;  STRING szLicenseFile;  LIST list, listStartCopy; BOOL bCustom; begin  // TO DO: if you want to enable background, window title, and caption bar title   // SetTitle( @PRODUCT_NAME, 24, WHITE );   // SetTitle( @PRODUCT_NAME, 0, BACKGROUNDCAPTION );   // Enable( FULLWINDOWMODE );   // Enable( BACKGRO
    Expand Post

Loading
Using a .NET DLL in InstallShield