views:

1085

answers:

1

I have a service [C# exe] and I can deploy it using Visual Studio Command Prompt window typing "InstallUtil MyService.exe". Now how to do the same thing from Install Shield 2009 Premier(and also start the service as we do manually)?

+1  A: 

There are two main options. The easy one, but not so recommended, is to add MyService.exe as the key file of a component, and mark the component as an Installer Class. This will invoke InstallUtilLib.dll (which functions similarly to InstallUtil.exe) to install this component. However all versions of InstallUtilLib has no handling for rollback, and will yield an incomprehensible message box window if there's any error; these are the reasons to prefer other approaches.

The other option starts the same way, with MyService.exe as the key file of a component. Then open the advanced options of the component and use the Install NT Services and Control NT Services nodes to install and start the service respectively. The potential downsides are that you'll need to know the internal name of the service to do this, and I'm not certain whether it works for all C# services.

Michael Urman