Local Installation of Files

When you install an application onto a computer via ClickOnce, you do not have a choice over where to store it. In fact, the application is stored on a per-user basis, and different versions of the application are stored in different folders. For example, when I installed MyApp on my computer, the application files were stored here:

C:\Documents and Settings\Wei-Meng Lee\Local

Generally, application files are stored in subdirectories under the C:\Documents and Settings\<User Name>\Local Settings\Apps\2.0 folder. If you want to programmatically locate this directory during runtime, use the following code:

'---ExecutablePath includes the executable name---
Dim path As String = Application.ExecutablePath
'---Strip away the executable name---
path = path.Substring(0, path.LastIndexOf("\"))

That's it. Now it's time to customize your installation.

Get Use ClickOnce to Deploy Windows Applications now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.