Solutions Products Download Purchase Support News Members Company
SITE FEED
Support Forum
The fastest and most effective to get answers to your questions quickly.
FAQs
Quick answers to common questions.
Troubleshooting
Known issues and basic troubleshooting techniques for problems or unexpected behaviors.
Knowledgebase
Technical tips, How-to articles, and other tutorials about ApexSQL Tools.
Online Documentation
All of our help files for download or convenient viewing online.
Videos
Watch product demos, training videos, or tutorials of our products' main features. 

ApexSQL Knowledgebase

Tips and How-to Articles for ApexSQL Tools


How to integrate ApexSQL Log API components into custom installer

DESCRIPTION
This article describes solutions for integrating ApexSQL Log API components into custom installer

SOLUTION
ApexSQL Log API components can be integrated into custom installer in two ways. The first one is running original ApexSQL Log API setup with the INNO setup switches for silent mode installation. The second solution is to create simple .NET application which will copy all required files, register them, create extended procedures on a server and check the activation status.
Let’s start with the first solution: running ApexSQL Log API installer from your installer:
To use the silent mode installation, use ApexSQL Log API setup with the following switches:
/VERYSILENT – this suppresses all installation wizard dialogs
/SUPPRESSMSGBOXES – this suppresses all messages from the installer
/LOADINF="filename" – this will load the previously saved installer settings (such as the installation directory, shortcuts and so forth…)
/SAVEINF="filename" – this will save all of your choices during an “ideal” installation (these choices will then be used in LOADINF switch)

1. Start ApexSQL Log API installer with SAVEINF switch from the command prompt (e.g. ApexSQLLogApi.exe /saveinf="logapi.inf"), make all necessary choices and finish the installation. This will save all your preferences to the .inf file In the following format:
[Setup]
Lang=eng
Dir=C:\Program Files\ApexSQL\ApexSQLLogApi2008
Group=ApexSQL\ApexSQL Log API 2008
NoIcons=0
SetupType=full
Components=client_side,server_side
Tasks=


2. Add this call to the custom setup step to run original ApexSQL Log API installer with the INF file created on previous step and the following switches:

ApexSQLLogApi.exe /VERYSILENT /SUPPRESSMSGBOXES /LOADINF =" logapi.inf"

The second solution is more complicated and consists of the below steps. The example of this solution can be found here

1. Create new Console Application project in Visual Studio and add a reference to the ApexSQL.Log.Api.dll in it

2. Add a reference to the ApexSql.Log namespace from within the code file:

      using ApexSql.Log;

3. Depending on how server-side installation will be performed add verification on the number of arguments passed to the console application from the customer setup. Let’s assume that application is receiving just server name

4. Configure engine by calling Config.ConfigureLogging
        static void ConfigureEngine()
{
// Engine configuration has to be done before first reference to Engine class.
// Setup logging file name and folder.
Config.LoggingConfiguration loggingConfig =
new Config.LoggingConfiguration();
loggingConfig.loggingEnabled =
true;
loggingConfig.logFileName = String.Format(
"ApexSqlLogApiInstallation.{0}.log", DateTime.Now.ToString("yyyyMMddHHmmss"));
Config.ConfigureLogging(loggingConfig);
}

5. Add verification on server-side components state on server and perform appropriate actions according to the current their state:
        static bool CheckVersionInformation(Database db)
{
ServerSideComponentsManager manager = Engine.CreateServerSideComponentsManager(db);

ServerSideComponentsState state = manager.ComponentsState;
switch (state)
{
case ServerSideComponentsState.NotInstalled:
{
Console.WriteLine(
"Server-side components are not installed. Installing server-side components to server {0}...",
db.Properties.server);
manager.InstallComponents();
break;
}
case ServerSideComponentsState.IncompleteInstallation:
{
Console.WriteLine(
"Server-side components are not correctly installed. Uninstalling and then installing server-side components on server {0}...",
db.Properties.server);

try
{
manager.UninstallComponents();
}
catch (System.Exception e)
{
Console.WriteLine(
"Exception occurred during uninstallation of server-side components: {0}", e.Message);
}

manager.InstallComponents();
break;
}
case ServerSideComponentsState.EarlierVersion:
{
Console.WriteLine(
"Installed server-side components are out of date (version {0}). Updating components on server {1}...",
manager.ComponentsVersion, db.Properties.server);
manager.InstallComponents();
break;
}
case ServerSideComponentsState.LaterVersion:
{
Console.WriteLine(
"Installed server-side components on server {0} are of later version ({1}). Please update your ApexSQL Log API version.",
db.Properties.server, manager.ComponentsVersion);
return false;
}
}

if (manager.ComponentsState == ServerSideComponentsState.CompatibleVersion)
{
Console.WriteLine(
"Installed server-side components on server {0} are compatible with this version of ApexSQL Log API.", db.Properties.server);
return true;
}
else
{
Console.WriteLine(
"Installed server-side components are still not up to date. Please check application log file for detailed errors.");
return false;
}
}

6. Compile the project

7. Add server-side component files to the custom installer:
  • ApexSqlLog2008XprocsIA64.dll
  • ApexSqlLog2008Xprocsx64.dll
  • ApexSqlLog2008Xprocsx86.dll
  • ApexSqlLog2008Activation.exe
  • ApexSqlLog2008ConnectionMonitorIA64.exe
  • ApexSqlLog2008ConnectionMonitorx64.exe
  • ApexSqlLog2008ConnectionMonitorx86.exe
  • ApexSqlLog2008ServerHelperIA64.exe
  • ApexSqlLog2008ServerHelperx64.exe
  • ApexSqlLog2008ServerHelperx86.exe
  • ApexSqlLogApi2008Activation.exe
  • ApexSqlLog2008ServerHelperIA64.sys
  • ApexSqlLog2008ServerHelperx64.sys
  • ApexSqlLog2008ServerHelperx86.sys

8. Add vcredist_x86.exe, which is part of the ApexSQL Log API setup to the custom setup

9. Add ApexSQL.Log.Api.dll to the custom setup

10. Add just compiled application to the custom setup

11. Extract and run vcredist_x86.exe from the setup

12. Extract compiled application, ApexSQL.Log.Api.dll and server-side components to
some temp location from the custom setup and run compiled application from here with the server specified as parameter

13. Server-side components should be installed on server passed to it as argument.

14. Example of the installation script which is used for ApexSQL Log API installation and created in the INNO you can find here

AUTHOR
Dmitriy Dyubchenko

LAST REVIEW DATE
26 November 2009

Labels:



© 2010 ApexSQL Tools All Rights Reserved | 1.919.968.8444 | Contact Us | Terms of Use | Privacy Policy