'Excel.exe still running in Task Manager in C sharp

I have a C sharp code which is not closing Excel.exe in Task manager. excelApp.Quit() is not closing the Excel.exe in task manager , can someone suggest me how to close the Excel.exe in task manager

          ToolingStageSheet = mainWorkbook.Worksheets["Tool-Progressive"];
                        totalToolingCost = Convert.ToDecimal(ToolingStageSheet.Cells[38, 15].Value);
                        mainWorkbook.Save();
                        mainWorkbook.Close(0);
                        excelApp.Quit();
                        System.Runtime.InteropServices.Marshal.ReleaseComObject(mainWorkbook);
                        System.Runtime.InteropServices.Marshal.ReleaseComObject(excelApp);
                        excelApp = null;


Solution 1:[1]

You can do with System.Diagnostics.

Please try the following code.

  Process[] processes = Process.GetProcessesByName("EXCEl");
  int pid = processes[0].Id;
  Process pro = Process.GetProcessById(pid);
  pro.Kill();

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ajay Gupta