Search code examples
wpfclickonce

Log installer info when installing WPF App


I have a WPF (Clickonce) app. I want to find out which users are installing or re-installing the app, and probably write those info in a database for audit.

How can I do that?


Solution

  • The current ClickOnce deployment doesn't provide any server-side hooks for monitoring whatsoever (in fact, the "website" generated by ClickOnce publishing is just a very simple, plain HTML page providing a link/button for downloading and executing the .application or setup.exe, respectively, on the client machine. Everything else is taking place locally).

    Now, depending on what you want to log (initial installations, or updates, or both) you have the following options:

    • Create your own website where user will register before getting access to the install/launch for the app (or maybe you just identify them by IP - depends on your needs) - this allows you to log who first installs the app, but not the automatic updates.
    • In your application, use the classes in the System.Deployment namespace (notably ApplicationDeployment) to access information about updates etc. whenever your application is run. You can then have your app make calls to a web service that you provide, where you can log any installation / launch action (or even other runtime information, like usage of certain features, exceptions etc).