I developed msi package in VS2010 using Windows Installer. Inside this package are some windows services written in C#. To each service I added installer, i. e. serviceInstaller and processInstaller.
During installation of product, service receive user defined name using this method

private string GetContextParameter(string key)
return Context.Parameters[key].ToString();

There are of course methods ProjectInstaller_BeforeInstall and ProjectInstaller_BeforeUninstall where is called method GetContextParameter in the beginning of these methods to pass the name of service. And here is problem. When windows service is installed, everything is OK. But when product is unninstalled, there must be also unninstalled services, but they are not. I discovered that when service is uninstalling it don't goes to the method ProjectInstaller_BeforeUninstall where is passed the name of service which is uninstalled.
Do you know the cause of this strange behaviour?
Thanks in advance
0 Comments   [ - ] Hide Comments


Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
Answer this question or Comment on this question for clarity


I suspect you may be over-engineering things.

The Windows Installer service interface has 2 tables for handling services: ServiceInstall and ServiceControl. I would imagine that the underlying functions of these tables can handle your requirement, meaning that all your package need to do is populate the tables with appropriate values and leave the WI engine to do the necessary.
Answered 05/19/2011 by: VBScab
Red Belt

Please log in to comment
Thank you. I know about this tables. But I think these methods can handle it. As I Mentioned, method ProjectInstaller_BeforeInstall worked as it should, it goes inside this method.
One important thing that whole product (including installer) is builded automatically. And if I manually change MSI DB, after build it is of course unchanged. So after each build it has to be changed manually.
There is no critical problem to implement some methods which will make this msi updates before installation, but If I am right methods inside service installer doing this work.
Answered 05/19/2011 by: Sorg
Senior Yellow Belt

Please log in to comment