NOTE: The asset management currently has an issue with targets located in a project subdirectory. In this case, an asset's files are not automatically copied to the target run directory, so the target cannot be run/executed! The problem is decribed The problem is decribed in PDR 7555 and will be corrected with one of the next updates!

The Asset Manager integrated into the Xbase++ Workbench provides an easy interface for viewing, (de-) installing and updating the assets being used in your projects. Behind the scene, the Asset Manager in conjunction with the Workbench, performs the following tasks for you:
  • Manage asset dependencies for each target in your project
  • Install/uninstall asset files required for using assets and for building your project
  • Copying required binaries/dlls to the target directory, allowing targets to be run/executed for debugging
  • Allow assets to be updated if a newer version exists
Currently, the automatic handling of the complexities involved only exists within the Xbase++ Workbench. A matching workflow on the commandline is under development but not yet available. The following outlines a procedure for making an asset available in a project not normally being developed with the Workbench. In this procedure, the Workbench is used only for installing the asset into the project directory, usage of the asset is done via pbuild.

Step 1: Create a dummy project for handling assets​

The following steps create a dummy project for adding/removing/updating assets to/from/in your project directory. The dummy project allows these tasks to be performed without having to load your regular project file into the Workbench.
  1. Start the Xbase++ Workbench, either via the Start menu or by typing "xwb.exe" on the commandline
  2. Use File -> Close All to make sure no project is open
  3. Select File -> New... and switch to the "Windows Target" tab
  4. Enter the path to your project directory into the "Location" box, or use the browse icon for selecting this directory
  5. Click into the "Name" box and type "dummy-target"
  6. Click on the icon for "Console Application" to select this as the target type
    1673540730368.png
  7. Click OK
  8. Close the Workbench
  9. We recommend renaming the dummy project to "asset-management.xpj" or something similar to better reflect its purpose. Note that if your regular application's project file is named "project.xpj", the dummy project will have been named "project1.xpj"!

Step 2: Adding an asset to the project directory​

In this step, we'll use the XbpHTMLViewer2 asset as an example for adding an asset to your project directory. To do this, you'll have to perform the following steps.
  1. Load the dummy project into the Workbench by double-clicking the project file or by starting the Workbench and using File -> Open ...
  2. Right-click on "dummy-target.exe" in the Project Manager pane on the left
  3. Select "Manage Assets ..." to open the Asset Manager
  4. Type "htmlview" into the search box at the top right
  5. Select the "XbpHTMLViewer2 Control" asset in the list
    1673540989414.png
  6. Click Add
  7. Click Close to close the Asset Manager

The above steps add the XbpHTMLViewer2 asset to the dummy project and also copy the asset's files into your project folder. You can verify this by checking the "Dependencies" node in Project Manager.

1673541095053.png


When adding an asset to the project, the documentation of the asset which comes in the form of a readme file will also be loaded into the editor to give you a chance to familiarize yourself. Most assets also come with an example which can be imported into the project. We recommend doing this as a reference for the asset's usage and for verifying everything is working correctly. Simply click the "Add example to project" link in the readme file. This adds a new target with the example to the dummy project.

1673541368844.png


Use File -> Save All to save any changes once you're done. Press F9 to build and run the example.

Note: the same procedure can be used to uninstall an asset and to remove the asset's files from your project folder. Click "Remove" in the Asset Manager to do this.

Step 3: Adding a dependency to an asset to your application project​

The third and last step is adding a dependency on the asset to your application project. This allows the Project Builder pbuild.exe to automatically locate asset files which are required for linking, and to copy dlls which are required for execution to the target directory .

This step is normally performed automatically for you by the Asset Manager. When not using the Workbench, the dependency must be added manually for ensuring the corresponding target can be built and executed successfully.

Adding the dependency must be performed for each target in which the asset is being used!

The following is an example of the steps which must be performed.
  1. Use the Workbench or your favorite editor for opening the dummy project (asset-management.xpj)
  2. Locate the dummy target to which the XbpHTMLViewer2 asset was added earlier (dummy-target.exe)
  3. Find the DEPENDS_ON= directive in the target's definition section. It will look like this:
    DEPENDS_ON = $(ASSETS_PATH)\xbphtmlviewer2
  4. Copy this line to clipboard
  5. Open your regular project file in the Workbench or some other editor
  6. Paste the line with the DEPENDS_ON= directive into the definition section of the target in which you want to use the XbpHTMLViewer2 asset. If this is the .EXE target of an application named "test", for example, the line must be pasted into the section following the [test.exe] node.
1673544835247.png


Once this step has been completed, you should be able to compile and execute your project/target. pbuild.exe should automatically locate the asset's .lib files for linking, and it should copy the required .dll files to your target directory for execution.

Further reading: