views:

72

answers:

3

Is it possible to mimic the way SQL Server installation works? With SQL Server you could have multiple "named instances" installed on the same machine. I believe it is one single executable but they do something in the registry to make it multiple instance. Anyone knows how SQL Server achieves this?

We have a window service develop with .net c# and would like to do the same. Having multiple instance running on the same machine...

It's a WCF service.

What I'd like to achieve is the user can run the MSI multiple times, and every time the user must provide an instance name. the instance name is the name that will appear in the services.msc So running the msi multiple time will end up have multiple instances in the services.msc

Can this be done with only one exe? Or I have to install each instance in different directory .. ?

+1  A: 

Yes of course this is possible with the same exe even. You simply need to create several services by different names in your installer.

There are other ways to do this too but you can p/invoke CreateService

Brian R. Bondy
Could you elaborate more on how to do it in the installer with the same exe? Like can the user run the MSI once, then when the user runs it the second time the user have to provide an instance name so the installer will use that instance name as the service name ... ? Possible?
pdiddy
+1  A: 

Yes, Windows Installer supports the concept of "multiple instance installs". You can read about how it works in InstallShield 2009(+) at:

Multiple Instance Installs

Christopher Painter
hmm I think the link is missing?
pdiddy
fixed his link.
Brian R. Bondy
+2  A: 

If you want many instances of the program you can always launch it many times (e.g. with different parameters). If you need all the instances to be different windows services, I recommend you this approach.

Please clarify what kind of service does your apps provides, because if e.g. you are hosting some kind of web service, you may have issues with all the instances trying to open the same TCP Port.

Gerardo Grignoli
I have added more info.
pdiddy