This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Re: Windows Services without key files
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jan 24, 2008
07:06 AM
Windows Services without key files
One more question for the forum:
I have a component underneath Feature A that installs an EXE file, and then several other components - each linked to a different subfeature - that install Windows Services. So I install the EXE only once, but want to have several different services all based on that same EXE.
When I try to create a component that only does Install Service, I don't get asked what EXE to build it on. This is, I assume, because it automatically goes for the key file in the component. But what if I don't want to have one? Is this doable?
I've tried adding the same EXE again to each of the subcomponents, but have been getting strange build errors. Will having the same EXE as part of 4 different components targeting the same folder be a problem? Additionally, if I later uninstall just one of the subfeatures, will it remove the EXE for everyone?
What's the best approach to this?
Thanks,
Avner
I have a component underneath Feature A that installs an EXE file, and then several other components - each linked to a different subfeature - that install Windows Services. So I install the EXE only once, but want to have several different services all based on that same EXE.
When I try to create a component that only does Install Service, I don't get asked what EXE to build it on. This is, I assume, because it automatically goes for the key file in the component. But what if I don't want to have one? Is this doable?
I've tried adding the same EXE again to each of the subcomponents, but have been getting strange build errors. Will having the same EXE as part of 4 different components targeting the same folder be a problem? Additionally, if I later uninstall just one of the subfeatures, will it remove the EXE for everyone?
What's the best approach to this?
Thanks,
Avner
(6) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jan 24, 2008
05:12 PM
Hmm... after looking at the ServiceInstall table, it looks like it simply sets the exe path based on the component. Not sure if this is possible to do without using a custom action, unfortunately, not a clean approach.
I would try using "sc create..." via a type 82 custom action... (do query on the winxp sc command for options) and try to go from there. But this is going to require you to have a few different CA's that install the different services with different conditions. Yuk.
Not sure on installing the exe in four different components, but that probably isn't the cleanest approach either...
I would try using "sc create..." via a type 82 custom action... (do query on the winxp sc command for options) and try to go from there. But this is going to require you to have a few different CA's that install the different services with different conditions. Yuk.
Not sure on installing the exe in four different components, but that probably isn't the cleanest approach either...
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jan 27, 2008
02:56 AM
alphacz wrote:
I would try using "sc create..." via a type 82 custom action... (do query on the winxp sc command for options) and try to go from there. But this is going to require you to have a few different CA's that install the different services with different conditions. Yuk.
Not sure on installing the exe in four different components, but that probably isn't the cleanest approach either...
If I have to sacrifice cleanliness, I would rather do it via 4 components each installing the same EXE (if I can get it to work, of course) rather than custom actions. Components are much easier to manage, so someone new looking at my project doesn't have to guess what CAs I have and where they fit into the install process.
I don't suppose anyone else has tried something similar, right?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jan 27, 2008
08:08 AM
I managed to get the install process working with my original hack - adding my Service.exe several times, each in its own component, and using the Install Service action to install it. It seemed to work - at least it configured the services correctly - but if I later try to modify my installation and remove some of the features, I see that they're not uninstalled - not only is the Windows Service not removed, but the files on disk are left behind, too.
Now I tried uninstalling the whole product - and all my services have been left behind. Furthermore, having several references to the same EXE caused InstallShield to leave MyService.EXE behind, even after uninstallation.
I have another Service as part of my installation, a clean one-exe-per-service one-service-per-exe by-the-book out-of-the-box scenario, and that service stayed installed too, even though its EXE was erased.
Am I doing something wrong, or is the Windows Service installation in Installshield totally broken?
Now I tried uninstalling the whole product - and all my services have been left behind. Furthermore, having several references to the same EXE caused InstallShield to leave MyService.EXE behind, even after uninstallation.
I have another Service as part of my installation, a clean one-exe-per-service one-service-per-exe by-the-book out-of-the-box scenario, and that service stayed installed too, even though its EXE was erased.
Am I doing something wrong, or is the Windows Service installation in Installshield totally broken?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jan 27, 2008
07:56 PM
The ServiceInstall table has a column called Component_ so yes, the target of the service is the keyfile of the associated component.
Now it's a component rule violation to try to have the same key file in multiple components.
However, you can have more then one ServiceInstall row associated to a component. In fact, the InstallShield IDE allows you to keep adding services via the Component | Advance Settings | Install NT Services view. Naturally to make this useful you'd have to pass differnt arguments to each service so that each running process would have a different behavior.
I've never actually tried this though because where I work we have a C# based generic service host process that reads an xml file and implements one to many tasks. Each task implements a certain interface and gets spawn off inside it's own thread so even though we have 10-20 tasks running, MSI and the SCM only knows about the one.
Now it's a component rule violation to try to have the same key file in multiple components.
However, you can have more then one ServiceInstall row associated to a component. In fact, the InstallShield IDE allows you to keep adding services via the Component | Advance Settings | Install NT Services view. Naturally to make this useful you'd have to pass differnt arguments to each service so that each running process would have a different behavior.
I've never actually tried this though because where I work we have a C# based generic service host process that reads an xml file and implements one to many tasks. Each task implements a certain interface and gets spawn off inside it's own thread so even though we have 10-20 tasks running, MSI and the SCM only knows about the one.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jan 28, 2008
12:20 AM
I know I can add several ServiceInstall calls on the same component, but that's the problem - I don't want them on the same component. I have 4 subfeatures that determine whether a service should be installed or not:
Feature A - copies MyService.exe
Subfeature B - installs MyWindowsService referencing MyService.exe
Subfeature C - installs MySecondWindowsService referencing MyService.exe
Can I add these to the same component, but use conditions somehow to have a specific service install only if a feature is installed?
I would rather not resort to custom actions since I feel that the whole area of sequences is very messy - if someone has to take over my project there'd better be damn good documentation, because there's no way someone will find my CA in the huge install sequence unless he knows that its there.
Feature A - copies MyService.exe
Subfeature B - installs MyWindowsService referencing MyService.exe
Subfeature C - installs MySecondWindowsService referencing MyService.exe
Can I add these to the same component, but use conditions somehow to have a specific service install only if a feature is installed?
I would rather not resort to custom actions since I feel that the whole area of sequences is very messy - if someone has to take over my project there'd better be damn good documentation, because there's no way someone will find my CA in the huge install sequence unless he knows that its there.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jan 28, 2008
11:40 AM
The ServiceInstall, Component and File tables are tightly coupled. The always gets installed if the component is installed and the components keyfile is always the service executable.
Sorry, what you want just isn't supported by MSI. You'll either have to clone your EXE to different filenames and make each the keyfile of it's own component and wire up a serviceinstall row to each component ( the only way to do it without a custom action ) or keep the one EXE and one Component and write a CA that evaluates the feature action states and from that calls SCM api's to create and start the service. If you go this way I would make the component belong to all of the features so that if any of the features get installed the component will get installed and it would take all of the features being uninstalled for the component to get uninstalled.
F1 - C1
F2 - C1
F3 - C1
If you use InstallScript, the CA's really aren't that difficult either.
Sorry, what you want just isn't supported by MSI. You'll either have to clone your EXE to different filenames and make each the keyfile of it's own component and wire up a serviceinstall row to each component ( the only way to do it without a custom action ) or keep the one EXE and one Component and write a CA that evaluates the feature action states and from that calls SCM api's to create and start the service. If you go this way I would make the component belong to all of the features so that if any of the features get installed the component will get installed and it would take all of the features being uninstalled for the component to get uninstalled.
F1 - C1
F2 - C1
F3 - C1
If you use InstallScript, the CA's really aren't that difficult either.
![](/skins/images/A5EADE085F77DE82FB3B14D6B307AE6A/responsive_peak/images/icon_anonymous_message.png)