Resource Files and Publish Type

In a smart client application, image files that you add on the Resource Files page in the project painter are designated as Include files. They are installed in the same directory as the application’s executable files, libraries, and other static files.

You can also specify that a file’s Publish Type is “Data File.” Files of this type are installed to a data directory. When an update to the application occurs, a data file might be migrated by the application.

The data directory is intended for application-managed data—data that the application explicitly stores and maintains. To read from and write to the data directory, you can use code enclosed in a conditional compilation block to obtain its path:

string is_datafilename
long li_datafileid

is_datafilename="datafile.txt"
#if defined PBWINFORM Then
   if System.Deployment.Application.
    ApplicationDeployment.IsNetworkDeployed=true then
      is_datafilename=System.Windows.Forms.
      Application.LocalUserAppDataPath+
      "\\"+is_datafilename
   end if
#end if

li_datafileid = FileOpen (is_datafilename, linemode!,
   write!, lockwrite!, append!)

For information about using preprocessor symbols such as PBWINFORM, see Conditional Compilation.