Kill windows service forcefully in WIX

后端 未结 2 1500
天命终不由人
天命终不由人 2020-12-12 07:03

I have windows service which will get installed as part of wix installation . Problem is that, currently service is in production and it is not responding to stop due to som

2条回答
  •  不知归路
    2020-12-12 07:30

    I have found a solution for this after digging for sometime .

    I am creating new C# custom action project and i am sequencing my action before InstallInitialize.

    In my C# custom action method, i am reading the existing installed file version by using FileVersionInfo.GetVersionInfo(filePath);

    Then i am checking with desired version which i want to check and if condition matches i am killing my service process using

     foreach (Process proc in Process.GetProcessesByName("ProcessName"))
     {
          proc.Kill();
          session.Log("Service Killed");
     }
    

    in order to achieve this, Wix toolset v3.11.1 has to installed beforehand

提交回复
热议问题