How to add argument in window service's main using wix installer and start service after installation

I have a window service's main with conditional to execute some method if the argument contains string such as "-service", "\instal", and so on. What tags that I need to add and where (whether it is in the components) in the Product.wxs to pass this parameter during the installation? I need to start the service after the installation, is it enough if I only set the Wait attribute in the ServiceControl element to be "no"?

Upvotes: 1

Views: 1604

Answers (1)

jbudreau
jbudreau

Reputation: 1307

I'd take a look at the ServiceControl MSI table - https://msdn.microsoft.com/en-us/library/aa371634(v=vs.85).aspx. This table allows the installer to setup command-line arguments to be passed each time the service starts up.

(The ServiceControl 'Arguments' table entries are authored in WiX through the <ServiceInstall> element - http://wixtoolset.org/documentation/manual/v3/xsd/wix/serviceinstall.html)

Upvotes: 2

Related Questions