The following code leaves a Microsoft Excel background process running, until after my program has exited:
var excelApplication = new Application();
var workbooks = excelApplication.Workbooks;
var workbook = excelApplication.Workbooks.Open(file.FullName);
workbook.Close();
excelApplication.Workbooks.Close();
excelApplication.Quit();
Marshal.ReleaseComObject(workbook);
Marshal.ReleaseComObject(workbooks);
Marshal.ReleaseComObject(excelApplication);
Why? What am I missing?
// do stuff
removed? The primary reason for this is some remaining references, allocated objects and so forth. – DrKoch