MarkusStrobl wrote:A major requirement is to install a service with a commandline parameter and start it afterwards (and do the opposite when uninstalling).
The service is a standard C++ service written using Win32API and can be installed with a call to the exe itself:
Install:
myservice.exe -i
Uninstall:
myservice.exe -u
[...]
Also when using CustomActions i wasn't successful so far.
Hello Markus,
as far as I know when using custom actions it is important to run the custom action after the installation directory has been determined and after the files have been copied to it.
My first guess for which sequence to use upon installation would be "InstallExecuteSequence/InstallFinalize" (context menu on "InstallExecuteSequence": Show Standard Action/Before Finalization/InstallFinalize).
In the custom action I would try to get the APPDIR property to know the installation directory and then execute the binary. You will have to use an "Execution Condition" to ensure that it runs only at installation (possibly "NOT Installed").
The following is an example in Javascript, using working code snippets, but the arrangement below is untested:
Code: Select all
function installServer()
{
var shell = new ActiveXObject("WScript.Shell");
try
{
var APPDIR = Session.Property("APPDIR");
// Remove trailing backslashes, if any
if (APPDIR.substr(APPDIR.length - 1) == "\\")
{
APPDIR = APPDIR.substr(0, APPDIR.length - 1);
}
// Path to binary in double quotes, parameters following after space char
var exec = "\"" + APPDIR + "\\binaryexe\" parameters_for_binary";
//shell.Popup("exec: " + exec);
shell.Run(exec, 0, true);
}
catch(e)
{
// The following code untested, but you get
// the idea
var msg = "Exception : " + e + "\r\n";
msg = msg + " name : " + e.name + "\r\n";
msg = msg + " number : " + e.number + "\r\n";
msg = msg + " message : " + e.message + "\r\n";
msg = msg + " description: " + e.description + "\r\n";
shell.Popup(msg);
}
FOLLOW US
Get the latest news in Application Packaging