What is the best way of counting the number of times that a ClickOnce-deployed program has been installed or updated? Also, is it possible to somehow track who is installing or updating it (e.g., geographically)?
views:
297answers:
5My ClickOnce application requires a login, so it is pretty easy to tell who is using the program from their registration and also their IP address.
Another way to do it is to check the server logs for hits on your packages. If you have it set up to check for updates on every execution, it'll hit the .application each time and when there are changes, hit the packages.
Probably the best way of doing this would be with logging tools on your web server. Log downloads to the .application etc (or maybe the actual dll/exe files, since the .application might get proped for auto-update checks).
Perhaps via an http-module, but any web-server logging tool should suffice. You can approximately deduce location from the IP (but you'd need to find your own provider).
However, ClickOnce is passive - there is no way to inject extra code into it. You could perhaps run some code on first run, but...
There is some info on MSDN Administering ClickOnce Deployments
One common requirement for enterprise usage of ClickOnce is the need to track which users have launched or installed which applications. An example of this is querying the specific version of an application most recently launched by the user. Tracking of this sort will likely need to be done on the deployment server to avoid the need to monitor potentially large numbers of client machines distributed over the network. Tracking on the client side would also require custom software development and installation because the ClickOnce runtime does not expose any hooks to plug in a custom launch event tracking solution.
In order to track which users have installed or launched which applications from the server side, you need to authenticate the user's identity and to detect and intercept file download requests. Your ability to do these things is affected by a number of factors.
One key factor is the network protocol used. ClickOnce supports HTTP (and HTTPS) or network file sharing (UNC path). HTTP provides the most flexibility because you can easily intercept inbound file requests on the server. You can still achieve some level of tracking with Windows file auditing and event logs, however these options are difficult to set up.
ClickOnce has an API that you can use. Checking the value of ApplicationDeployment.IsFirstRun on application start and do what you need to do there.
Host a Web service that logs the IP address of the requestor. Call the Web service in your application at startup. Location is tied to IP address and you could probably figure it out from there. :)