2.5. Application Files
Clicking the Application Files button will open a window that displays all of the files in your application (see Figure 1-8).
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:
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 _aead9e7ff36b675c\Data
Keep in mind that when you update an application, the database files in the data directory do not download again. This is logical, since when you update an application, only its business logic should upgrade, not its data files.
Note: The database files will download again only if the original database files on the server have been modified.