Walkthrough: Building with commands

Besides building and deploying your PowerServer project in the PowerBuilder IDE, you can also build and deploy your PowerServer project with a command-line tool (PBAutoBuild250.exe).

Exporting the build file
Preparing the environment

For convenience, you can directly export the configuration of an existing PowerServer project from the PowerBuilder IDE to a JSON build file. Therefore, you will need to prepare a proper environment first.

Step 1: Install the following software to set up the PowerBuilder development environment.

  • Windows 11 or 10

  • PowerBuilder IDE 2025

  • PowerBuilder Runtime 2025

  • PowerServer Toolkit 2025

Step 2: Follow Quick Start > Guide 1 to

  1. create a PowerServer project for the Example Sales Demo;

  2. build and deploy the PowerServer project (using the Build & Deploy PowerServer Project option in the PowerBuilder IDE) successfully; and

  3. run the installable cloud app successfully.

Exporting the build file

Now let's export the PowerServer project settings of the Example Sales Demo to a JSON file.

You can export the current project or all projects from the workspace (or target).

To export the current project:

  1. Open the workspace for the Example Sales App in the PowerBuilder IDE, and then double-click the PowerServer project object to open the object in the project painter.

  2. When the project painter is opened, click the Export PowerServer Build File button () in the toolbar.

  3. In the Export Build File dialog box, specify the settings, write down the path and filename to be exported, and then click Export.

    For more information about the settings, refer to Build & deploy using commands.

    The current project will be exported to the build file.


To export all of the projects from the workspace (or target):

  1. Open the workspace for the Example Sales App in the PowerBuilder IDE, and then right click the workspace (or target) in the System Tree and select Export Build File.

  2. In the Export Build File dialog box, select which target(s) to be exported.

    If the workspace contains multiple targets, then by default all targets will be exported to the same build file.

  3. Select which project type(s) to be exported.

    By default, all project types under the workspace (or target) will be exported to the build file.

  4. Specify the settings, write down the path and filename to be exported, and then click Export.


Modifying the build file
About the build file

The exported build file contains all the settings required for building and deploying the PBL files of the application and some additional settings.

Build file content

Description
    "MetaInfo": {
        "IDEVersion": "250",
        "RuntimeVersion": "25.0.0.1311"
    },

This section contains the version number of the PowerBuilder IDE and PowerBuilder Runtime currently in use.

    "BuildPlan": {
        "SourceControl": {
            "PreCommand": "",
            "ClearSrcBeforeDownload": false,
            "SVN": [
                ...
            ],
            "Git": [
                ...
            ],
            "VSS": [
                ...
            ],
            "Merging": [
                ...
            ],
            "PostCommand": ""
        },
        "BuildJob": {
            "PreCommand": "",
            "Projects": [
                ...
       ],
            "PostCommand": ""
        }
    },

This section contains settings for source control and build jobs.

  • "SourceControl" -- Provides settings for downloading and merging source code from the source control server (including SVN, Git, and/or VSS).

    You can download source code from SVN, Git, or VSS. If the source code is the objects in ws_objects, you can merge the objects to the PBL file.

    You can download and merge source code for one or more targets at one time. See Getting source code from SVN, Git, or VSS for more details and examples.

    The "ClearSrcBeforeDownload" setting is for removing files from the source code folder (specified by the "DestPath" setting) before downloading the source code.

    The "Git" > "Branch" setting is for downloading source code from the specified branch.

    The "Merging" > "RefreshPbl" setting is for refreshing the PBL files by deleting and then generating the PBL files again.

    Tip

    If you use Git repositories to host and collaborate on your code using Team Foundation Server (TFS) or Azure DevOps Server, you can configure the "Git" section in the build file to connect to Team Foundation Server (TFS) or Azure DevOps Server. See the next section for more information.

  • "BuildJob" -- Contains the location of the PowerBuilder application target(s) and the name of the project object(s).

    You can specify one or more targets and projects (of the same or different type) and build them at one time.

Both the "SourceControl" and "BuildJob" blocks contain a "PreCommand" key and a "PostCommand" key which allow you to specify commands that can be executed before and/or after that particular block is executed. See Executing additional commands for more examples.

The commands in "PreCommand" and "PostCommand" can be executed in synchronous (default) or asynchronous mode, and the command window can be visible or invisible (default). For example,

"PostCommand": "postcmd.bat /show /async"
    "Projects": {
        "project1": {
            ...
        },
        "project2": {
            ...
        },
        "project3": {
            ...
        },
        ...
    }

This section lists the project(s) that has been exported. Every single setting that can be found in the project painter can also be found here. You can modify the settings here when necessary.

Besides the settings of the project painter, you could also configure the "UFAReport" key to enable/disable unsupported feature analysis for the PowerServer project (equivalent to the "During compilation, report unsupported PowerScript features for PowerServer deployment" option).

Note

The value of "namespace" should never be modified; the namespace is used internally to locate the PowerServer C# models and embedded SQLs.


Settings in the build file are independent of each other; they run in sequence but do not rely on others or execution results, for example, if there is already source code in ws_objects, then you only need to set the Merging setting, and leave Git, SVN, and VSS empty as there is no need to download source code; or if there are PBLs in your Git server, then you only need to set the Git setting (to download PBLs) and leave the Merging setting empty. If you do not want a setting to run, just leave that setting with no values; or add "\\" in front of the setting name, for example, "\\Git" or "\\SourceControl", to skip the setting.

It is recommended that after you make a copy of the exported build file, you place it to the same location or a location near your PowerBuilder application target, so that you could manage the file path (especially the relative file path) easily.

Note: the relative path specified in the build file is relative to the build file.

Getting source code from SVN, Git, or VSS

You can configure the exported build file to download source code from SVN, Git, or VSS before the build process starts.

Step 1: Open the build file in a text editor, locate the "BuildPlan" block and then configure the corresponding keys.

If the computer connects to Git or SVN through a proxy server, make sure to configure the proxy server in the "Proxy" part.

The following example shows how to download source code from Git:

    "BuildPlan": {
        "SourceControl": {
            "PreCommand": "",
            "ClearSrcBeforeDownload": false,
            "SVN": [
                {"SrcPath": "","User": "","Password": "","DestPath": "","Proxy": {"Ip": "","Port": 0,"Username": "","Password": ""}}
            ],
            "Git": [
                {"SrcPath": "https://github.com/Appeon/PowerBuilder-AutoBuild-Sales-SourceCode", "User": "tester@appeon.com", "Password": "YGRrYjc6OzU=", "DestPath": ".\\Build_Sales", "Branch": "", "Proxy": {"Ip": "","Port": 0,"Username": "","Password": ""}}
            ],

You can also download source code from multiple targets at one time:

           "Git": [
                {"SrcPath": "https://github.com/Appeon/PowerBuilder-AutoBuild-Sales-SourceCode", "User": "tester@appeon.com", "Password": "YGRrYjc6OzU=", "DestPath": ".\\Build_Sales", "Branch": "", "Proxy": {"Ip": "","Port": 0,"Username": "","Password": ""}},
                {"SrcPath": "https://github.com/Appeon/PowerBuilder-AutoBuild-Examples-SourceCode", "User": "tester@appeon.com", "Password": "YGRrYjc6OzU=", "DestPath": ".\\Build_Examples", "Branch": "", "Proxy": {"Ip": "","Port": 0,"Username": "","Password": ""}}
            ],

The following example shows how to download source code from Team Foundation Server (TFS) or Azure DevOps Server:

IMPORTANT: To download source code from Team Foundation Server (TFS) or Azure DevOps Server, you will need to configure the "Git" section, and input your Personal Access Token (PAT) as the user name and password for connection.

    "BuildPlan": {
        "SourceControl": {
            "PreCommand": "",
            "ClearSrcBeforeDownload": false,
            "SVN": [
                {"SrcPath": "","User": "","Password": "","DestPath": "","Proxy": {"Ip": "","Port": 0,"Username": "","Password": ""}}
            ],
            "Git": [
                {"SrcPath": "https://402977329@dev.azure.com/402977329/kittytest/_git/kittytest","User": "402977329@qq.com","Password": "ZHFgcXVsZndtY2hicHJkZHxuMXlicXxufjF7OzVzOzB8ejpmcjthZz15eWB5aW0/bDV+eQ==","DestPath": "C:\\TFStest\\bug1853_1","Branch": "master","Proxy": {"Ip": "","Port": 0,"Username": "","Password": ""}}
            ],

The following example shows how to download source code from VSS:

    "BuildPlan": {
        "SourceControl": {
            "PreCommand": "",
            "ClearSrcBeforeDownload": false,
            "SVN": [ 
                {"SrcPath": "","User": "","Password": "","DestPath": "","Proxy": {"Ip": "","Port": 0,"Username": "","Password": ""}}
            ],
           "Git": [
                {"SrcPath": "","User": "","Password": "","DestPath": "","Branch": "","Proxy": {"Ip": "","Port": 0,"Username": "","Password": ""}}
            ],
            "VSS": [
                {"SrcPath": "\\\\192.168.0.100\\Project_VSS\\\"$/Salesdemo/native_pb/appeon.salesdemo\", YYOAAAAA","User": "tester","Password": "","DestPath": ".\\Build_Sales"}
            ],

Notes:

1) Connecting to Git or SVN through a proxy server is supported, but connecting to VSS through a proxy server is not supported yet.

2) The password for VSS is not supported. The VSS login window will be displayed for you to input the password before downloading the source code. The password for SVN or Git must be an encrypted value which is generated from the original password by executing "PBAutoBuild250.exe /p", as shown below.


3) Getting an SVN/VSS branch is completely unsupported. Getting a Git branch can be supported by using the "Branch" setting.

Step 2: If the source code downloaded from SVN, Git, or VSS is not the PBL file but objects in ws_objects, then you will need to merge the objects to the PBL file. Locate the "Merging" block in the build file and then configure it as below:

Setting "RefreshPbl" to true if you want to refresh the PBL files by deleting and then generating the PBL files again.

            "Merging": [
                {"Target": ".\\Build_Sales\\salesdemo.pbt", "LocalProjectPath": ".\\Build_Sales", "RefreshPbl": true}
            ],

You can also merge source code for multiple targets at one time:

            "Merging": [
                {"Target": ".\\Build_Sales\\salesdemo.pbt", "LocalProjectPath": ".\\Build_sales", "RefreshPbl": true},
                {"Target": ".\\Build_Examples\\examples.pbt", "LocalProjectPath": ".\\Build_Examples", "RefreshPbl": true}
            ],

Merging will not only merge the source code but also upgrade the source code to the current version. However, it will not check or upgrade the PBD files used in the library list (you will need to replace the PBD files with the corresponding version).

At the same time, make sure to double check the target location is set correctly in the "Projects" block, for example,

        "BuildJob": {
            "PreCommand": "",
            "Projects": [
                {"Target": ".\\Build_Sales\\salesdemo.pbt", "Name": "ps_salesdemo"}
                {"Target": ".\\Build_Examples\\examples.pbt", "Name": "pb_examplesdemo"}
            ],
            "PostCommand": ""
        }

When the PBAutoBuild250.exe command is executed later, it will first download the source code from the server and then merge the source code, as shown below.


Uploading a launcher package

The command-line tool will not be able to upload the cloud app launcher unless PowerBuilder IDE is installed on the same machine. Therefore, you will need to copy the launcher from the PowerBuilder IDE (you can create a launcher package using the Cloud App Launcher Profiles window), and then modify the "CloudAppLauncherPath" setting in the build file to point to this package, so that the tool can upload the launcher to the server.

Executing additional commands

The entire build & deploy process is made up of several steps, and additional commands can be executed before and/or after some particular steps such as the "SourceControl" and "BuildJob" steps.

Example 1: to add commands to remove a folder before downloading the source code.

Step 1: Create a bat file which contains the following command, and save the bat file as Command_DeleteFolder.bat.

RMDIR /s /q "D:\PB2025\SalesDemo\Build"


Step 2: In the build file, locate the "BuildPlan" block and then the "PreCommand" setting; and add the file path and name of Command_DeleteFolder.bat.

    "BuildPlan": {
        "SourceControl": {
            "PreCommand": "Command_DeleteFolder.bat",
            "ClearSrcBeforeDownload": false,
            "SVN": [
                ...
            ],

When the PBAutoBuild250.exe command is executed later, it will execute the commands in Command_DeleteFolder.bat before it downloads the source code.

Besides the "PreCommand" setting, there is also a "PostCommand" setting for the "SourceControl" and "BuildJob" steps, which allows you to execute commands after that particular step. See Example 2 and 3 for more details.

Example 2: to add commands to start the PowerServer Web APIs after building the PowerServer project in the PowerBuilder IDE.

Step 1: Create a bat file which contains the following command, and save the bat file as startwebapi.bat.

dotnet.exe run --no -build --project C:\Users\appeon\source\repos\PowerServer_salesdemo\ServerAPIs\ServerAPIs.csproj

Step 2: In the build file, locate the "BuildJob" block and then the "PostCommand" setting; and add the file path and name of startwebapi.bat.

        "BuildJob": {
            "PreCommand": "",
            "Projects": [
                ...
            ],
            "PostCommand": "startwebapi.bat /show /sync"
        }

When the PBAutoBuild250.exe command is executed later, it will execute the commands in startwebapi.bat after it finishes building the PowerServer project.

Example 3: to publish the PowerServer Web API after building the PowerServer project in the PowerBuilder IDE.

Step 1: Create a bat file which contains the following command, and save the bat file as publish.bat.

dotnet.exe publish C:\Users\appeon\source\repos\PowerServer_salesdemo\ServerAPIs\ServerAPIs.csproj -c release -o C:\Publish

Step 2: In the exported build file, locate the "BuildJob" block and then the "PostCommand" setting; and add the file path and name of publish.bat.

        "BuildJob": {
            "PreCommand": "",
            "Projects": [
                ...
            ],
            "PostCommand": "publish.bat /show /sync"
        }

When the PBAutoBuild250.exe command is executed later, it will execute the commands in publish.bat after it finishes building the PowerServer project.

Note

The dotnet commands can also be integrated with Jenkins. See Task 2 for more details.

Building with commands
Preparing the environment

To build and deploy the PowerServer project using the command-line tool (instead of within PowerBuilder IDE), install the following software.

  • Windows 11 or 10, or Windows Server 2022, 2019, or 2016

  • PowerBuilder Utilities 2025

    The command-line tool (PBAutoBuild250.exe) is included in PowerBuilder Utilities.

  • PowerBuilder Runtime 2025

  • PowerServer Toolkit 2025

The PBAutoBuild250.exe tool can automate the entire build and deploy process outside PowerBuilder (without needing any PowerBuilder license).

If the DB2, MySQL, Oracle, or Informix database connection is used, you will need to manually download the database driver from the NuGet website, by following instructions in the next section Preparing the database driver.

Preparing the database driver

You need to manually prepare the database driver if the DB2, MySQL, Oracle, or Informix database connection is required.

Tips:

1) To unzip a NuGet package, you can change the file extension from .nupkg to .zip, and then unzip the file.

2) If you have PowerBuilder IDE installed on another machine, you can have PowerBuilder IDE download and install the driver automatically, and then you can directly copy the folder from there (without needing to manually download the driver).

3) If there is any inconsistency between the document and the product message regarding the minor version number of the driver, please follow the product message as the authoritative source.

4) Make sure that drivers are copied to the specified location, so that they can be automatically loaded by PBAutoBuild250.exe.

MySQL

Step 1: Create the following directory under %USERPROFILE%: %USERPROFILE%\.netdbdrives\mysql\8.0.32.1.

Step 2: Download MySql.Data 8.0.32.1 and the license file.

Step 3: Unzip the file, and copy MySql.Data.dll from MySql.Data.8.0.32.1\lib\netstandard2.1\ to %USERPROFILE%\.netdbdrives\mysql\8.0.32.1.


Oracle

Step 1: Create the following directory under %USERPROFILE%: %USERPROFILE%\.netdbdrives\oracle\3.21.100.

Step 2: Download Oracle.ManagedDataAccess.Core 3.21.100 and the license file.

Step 3: Unzip the file, and copy Oracle.ManagedDataAccess.dll from Oracle.ManagedDataAccess.3.21.100\lib\netstandard2.1\ to %USERPROFILE%\.netdbdrives\oracle\3.21.100.


Informix / DB2

Step 1: Create the following directory under %USERPROFILE%:

For Informix: %USERPROFILE%\.netdbdrives\informix\3.1.0.600

For DB2: %USERPROFILE%\.netdbdrives\db2\3.1.0.600

Step 2: Download IBM.Data.DB2.Core 3.1.0.600 and the license file.

Step 3: Unzip the file.

Step 4: Copy the IBM.Data.DB2.Core.dll file from IBM.Data.DB2.Core.3.1.0.600\lib\netstandard2.1\ to %USERPROFILE%\.netdbdrives\informix\3.1.0.600 or %USERPROFILE%\.netdbdrives\db2\3.1.0.600.

Step 5: Copy the clidriver folder from IBM.Data.DB2.Core.3.1.0.600\buildTransitive to %USERPROFILE%\.netdbdrives\informix\3.1.0.600 or %USERPROFILE%\.netdbdrives\db2\3.1.0.600.


Running the command-line tool

Step 1: Copy the exported JSON build file to the current machine and double check the file paths in the build file are appropriate to the current environment.

Step 2: Copy the application source code (including PBT, PBL, PBR, images, INI etc.) to the current machine, or configure the build file to download source code from the source control server.

Step 3: In the command-line window, execute the PBAutoBuild250.exe file and the build file. For example,

PBAutoBuild250.exe /f "D:\PB2025\SalesDemo\ps_salesdemo.json" /l Log_PSBuild.log /le Log_PSError.log /lu Log_PSUnsupport.log

The PBAutoBuild250.exe file can be run with parameters. For a complete list of supported parameters, refer to PBAutoBuild supported parameters.

Step 4: Carefully check the information in the command-line window to make sure the build and deploy process is successful.


The build file and commands used in this guide can be downloaded from https://github.com/Appeon/PowerBuilder-AutoBuild-Sales-Example. After you download these files to D:\PB2025\SalesDemo\, you can follow the instructions in the readme file.

Verifying if PBAutoBuild is successful

After executing the PBAutoBuild250.exe file and the build file, you can check if the execution is successful via the Windows command errorlevel:

  • errorlevel = 0 indicates the process was successful.

  • errorlevel = 1 indicates the process encountered an error.

You can write scripts as below to check the execution result:

Echo off
PBAutoBuild250.exe /f "D:\PB2025\SalesDemo\ps_salesdemo.json" /l Log_PSBuild.log /le Log_PSError.log /lu Log_PSUnsupport.log
If %ERRORLEVEL% == 0 (
    echo Run PBAutoBuild successfully.
) Else (
   echo Failed to run PBAutoBuild, Errorlevel is %ERRORLEVEL%.
)
Integrating with Jenkins

The PBAutoBuild250 command can integrate with Jenkins to automate the build and deployment process for PowerServer projects. Refer to the Jenkins user documentations for how to use Jenkins.

Following gives a few examples on how to integrate the PBAutoBuild250 and dotnet commands with Jenkins.

Example 1: to execute the PBAutoBuild250 command and the build file.


Example 2: to download source code from SVN, Git, or VSS, and then execute the PBAutoBuild250 command and the build file.

Double check that the PBT location is the same one in all required areas.



Example 3: to publish or run the PowerServer Web APIs

You can integrate dotnet commands with Jenkins. After you install the .NET SDK Support plugin for Jenkins, the dotnet commands (for example, dotnet publish, dotnet run etc.) are available as shown below. Refer to https://www.jenkins.io/doc/pipeline/steps/dotnet-sdk/ for more details.