Resource files and publish type

Click the Add Files button on the Resource Files page to select image files that your application requires. PowerBuilder .NET Windows Forms do not support PBR files, and they are unable to locate images embedded in PBD files. All resource files must be relative to the path of the .NET Windows Forms target. If the files your application requires are not in the directory structure accessible from the Choose Required Resource Files dialog box, copy them into the directory structure, then reopen the dialog box.

Image files 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 more information about using preprocessor symbols and conditional compilation, see Chapter 14, “Referencing .NET Classes in PowerScript.”

If your application uses .NET assemblies, as in the previous example, specify them on the .NET Assemblies tab page in the target’s Properties dialog box. Before you deploy a PowerBuilder .NET smart client application that uses data files, make sure the System.Windows.Forms.dll and System.Deployment.dll assemblies are listed on this page.

This dot NET tab of the target properties dialog box displays two assembly references for the target.

Other files, such as database drivers and PowerBuilder DLLs, should be included on the Prerequisites page if you are publishing a smart client application, or on the Library Files page.