2

I have an WPF application which also has an system tray icon. I am currently working on a WiX Installer solution to upgrade my WPF application. The installer should close the running application without message popup asking the user to that manually. I started using the tag "CloseApplication" in my main wix wxs file:

<util:CloseApplication Id ="myapp" Target="MyApp.exe" CloseMessage="yes" RebootPrompt="no" ></util:CloseApplication>

It closes the main application and the icon in the system tray, but the process gets converted to a background process. The WiX Installer reacts again with a popup asking for closing the application. This popup asking the user to close the application manually needs to be avoided. I also had a look in the history of asked question here in stackoverflow but none of them is providing a proper solution or at least workaround. The research in the internet was also poor on working solutions. Is this still an issue ? How to get rid of the popup to close the application?

  • What context does the **`MyApp.exe`** run with? User rights? How have you conditioned and sequenced the call to `CloseApplication`? `Immediate`? `Deferred`? GUI? Does your application support the [RestartManager](https://learn.microsoft.com/nb-no/windows/desktop/RstMgr/restart-manager-portal) feature? (controlled, automatic shutdown and restart of application) ([technical implementation details](https://www.advancedinstaller.com/user-guide/qa-vista-restart-manager.html)). And [some details on RestartManager from a practical viewpoint](https://stackoverflow.com/a/50935008/129130). – Stein Åsmul May 16 '19 at 12:38
  • With the attributes you currently use for `CloseApplication`, the application needs to handle `WM_CLOSE` to actually shut down the application. Check if you are doing something special in your `WM_CLOSE` handler. You may also try ` – zett42 May 16 '19 at 15:05
  • 1
    The provided hints were really helpfull and this is the peace of code which made it running: ``` ``` –  May 17 '19 at 13:37
  • You can add that as an answer on your own and set it accepted if you'd like. – Stein Åsmul May 18 '19 at 01:36

0 Answers0