Hi,
I am having a windows service where I am programatically uninstalling it if previous version exists and installing the service.
The code to uninstall as below
- private void ProjectInstaller_BeforeInstall(object sender, System.Configuration.Install.InstallEventArgs e)
- {
- List<ServiceController> services = new List<ServiceController>(ServiceController.GetServices());
-
- foreach (ServiceController s in services)
- {
- if (s.ServiceName == this.serviceInstaller1.ServiceName)
- {
- ServiceInstaller ServiceInstallerObj = new ServiceInstaller();
- ServiceInstallerObj.Context = new System.Configuration.Install.InstallContext();
- ServiceInstallerObj.Context = Context;
- ServiceInstallerObj.ServiceName = "SARWindowsService";
- ServiceInstallerObj.Uninstall(null);
-
- break;
- }
- }
- }
Now it do uninstall the service before installing the new build but the problem is
the code change i make doesnot reflect in the new build.
Can anyone help on this
Thanks