How to write a WinForms application that would not have any visible element except from a tray icon and at the same time allow the application to be closed by Windows Installer if the file is in use? As I understand it the Windows Installer sends a WM_CLOSE message to application's main window. I assume that the "main window" is indicated by MainForm property of ApplicationContext. Also it seems to me that for this mechanism to work the form must have been shown at least once.
I found some workarounds like creating an empty form and setting its opacity to 0 (to minimize flicker) then showing and hiding, but describing this as a nasty hack would heavily underestimate its ugliness.