0

I want to install a 3rd party service with WIX. it was originally not a windows service but 3rd party has supplied one more exe and with help of some commands we can install this as windows service. I tried it with custom action as System.Diagnostics.Process and argument I supplied was:

startServiceProcess.StartInfo.FileName = installExePath;

startServiceProcess.StartInfo.Arguments = string.Format(CultureInfo.InvariantCulture, "{0} {1} {2} {3}", "-c " + FilesPath, @"-e " + ExePath, @"-l " + debugFilePath, "-n " + NewServiceName);

I want to install this service with ServiceInstall element in WIX (without custom action).

Is there any way I can supply custom argument to ServiceInstall? These argument contain some path as well.

Maddie
  • 69
  • 1
  • 7
  • I think you want to look at this: https://stackoverflow.com/questions/8595338/wix-installer-to-replace-instsrv-and-srvany-for-user-defined-service-installatio/23680076#23680076 – Christopher Painter May 02 '18 at 22:53
  • Do you happen to know what tool they used (if any) to deliver the EXE file that you install as a service? It doesn't look like this is a srvany.exe converted service? Is the final service.exe a .NET assembly or a C++ binary or some other type of binary? Do you know where these command line parameters are written? If they go to the registry, you should be able to write them directly yourself from your MSI? Many services read settings from a settings file as well. Is there a settings file for your service binary? (there could still be one, even if you are told to use command line parameters) – Stein Åsmul May 03 '18 at 01:26

1 Answers1

1

There are two different uses of the term "arguments" here.

There are arguments that you can supply to a service executable on the command line that will make the service install itself, after which it is a service. If you want to use ServiceInstall to install the service then you don't need this command line.

When it starts as an installed service there are other arguments you can pass to the service that will be used every time it starts. You don't want the "install" command line used every time the service starts, typically these are run-time arguments for the service.

So ideally the service can be installed with a ServiceInstall element (instead of a command line) because ServiceInstall is the standard way in Windows Installer. And also, the 3rd party may need to specify if the installed service needs any arguments (parameters) every time it starts. These can be specified in the ServiceInstall element, and arguments are a "formatted" string, so you can pass properties (such as folder locations) in the usual way, putting them in square brackets, such as [INSTALLFOLDER]

PhilDW
  • 20,260
  • 1
  • 18
  • 28