Application Files

Clicking the Application Files button will open a window that displays all of the files in your application (see Figure 1-8).

All of the files in your application

Figure 1-8. All of the files in your application

There are three publish statuses you can set for all the files in your application. They are:

  • Include: Lets you include the file in the manifest and copy to the publish location.

  • Data File: Lets you include the file in the manifest and copy to the publish location. Files with the extensions .mdf, .ldf, .mdb, and .xml are set to Data File by default.

  • Exclude: Lets you exclude the file from the manifest and not copy to the publish location.

Tip

Any non-assembly file for which the Build Action property is set to Content can have the Data File publish status. Files with the extensions .mdf, .ldf, and .xml are set to Data File by default.

Figure 1.9 shows that, by default, the two database files Database1.mdf and Database1_log.ldf will always download to your users' machines when you install the application via ClickOnce. However, they will not be stored in the application directory. Instead, they will be stored in the data directory. So how can you programmatically find the data directory for your installed application? You can do so using:

Dim dataPath As String = Application.LocalUserAppDataPath

On my machine, a typical data directory looks like this:

C:\Documents and Settings\Wei-Meng Lee\Local Settings\Apps\2.0\Data\98HM3VZV.OK7\V4JVEH8D.37Y\myap..tion_692c12755750aeaa_0001.0000 ...

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.