.NET Assembly Targets – PB Docs 150


.NET Assembly Targets

PowerBuilder includes a target type for creating .NET assemblies from nonvisual custom class objects.

You can create .NET Assembly targets from scratch or by using PBLs from an existing target that contain at least one nonvisual custom class object.

Note: The .NET Assembly target type is available in both PowerBuilder Classic and PowerBuilder .NET. To take advantage of Common Language Specification (CLS) compliant features, use the .NET Assembly target in PowerBuilder .NET.

Creating a target from scratch

When you use the .NET Assembly target wizard to create a target from scratch, the wizard also creates an Application object, a project object that allows you to deploy the assembly, and a nonvisual object (NVO). However, you must add and implement at least one public method in the wizard-created NVO before it can be used to create a .NET assembly.

This table describes the information you must provide for .NET Assembly targets that you create from scratch:

Wizard field Description
Project name Name of the project object the wizard creates.
Library Name of the library file the wizard creates. By default, this includes the current Workspace path and takes the name you enter for the project object with a PBL extension.
Target Name of the target the wizard creates. By default, this includes the current Workspace path and takes the name you enter for the project object with a PBT extension.
Library search path Lets you add PBLs and PBDs to the search path for the new target.
PowerBuilder object name Name of the nonvisual object the wizard creates. By default this takes the name that you entered for a project object with an �n_� prefix.
Description Lets you add a description for the project object the wizard creates.
Namespace Provides a globally unique name to assembly elements and attributes, distinguishing them from elements and attributes of the same name but in different assemblies.
Assembly file name Name of the assembly created by the wizard. By default, the assembly file name takes the namespace name with a DLL suffix.
Resource file and directory list List of resource files, or directories containing resource files, that you want to deploy with the project.

You can use the Add Files, Add Directories, or Search PBR Files buttons to add files and directories to the list box. You can select a file or directory in the list and click the Delete button to remove that file or directory from the list.

When you select a directory, the resource files in all of its subdirectories are also selected by default. However, you can use the Resource Files tab in the Project painter to prevent deployment of subdirectory files. For more information, see Resource Files and Library Files tabs.

Win32 dynamic library file list Specifies any Win32 DLLs you want to include with your project. Click the Add button to open a file selection dialog box and add a DLL to the list. Select a DLL in the list and click Delete to remove the DLL from the list.
Setup file name Name of the setup file the wizard creates. You can copy this MSI file to client computers, then double-click the files to install the .NET assembly on those computers.

Creating a target from an existing target

If you select the option to use an existing target, the wizard creates only the .NET Assembly target and a .NET Assembly project. The target you select must include a PBL with at least one nonvisual object having at least one public method. The public method must be implemented by the nonvisual object or inherited from a parent. The AutoInstantiate property of the nonvisual object must be set to false.

Note: All objects from an existing target are visible in the System Tree for the .NET Assembly target created from the existing target, except for any project objects that are incompatible with the new target. Although visual objects, as well as the application object, are not used in a .NET Assembly target, you can view them in the System Tree under the new target�s PBLs.

When you use the wizard to create a .NET Assembly target from an existing target, the wizard prompts you for the same information as when you create a target from scratch, except that it omits the PowerBuilder object name and library search path fields. These fields are unnecessary because the existing target must have a usable nonvisual object and the library search path for the target is already set. The wizard does, however, present fields that are not available when you create a target from scratch.

This table describes these additional fields:

Wizard field Description
Choose a target Select a target from the list of targets in the current workspace.
Specify a project name Select a name for the project you want to create. You must create a project object to deploy nonvisual objects as .NET components.
Choose a project library Specify a library from the list of target libraries where you want to store the new project object.
Choose NVO objects to be deployed Expand the library node or nodes in the list box and select check boxes next to the nonvisual objects that you want to deploy.
Use .NET nullable types Select this check box to map PowerBuilder standard datatypes to .NET nullable datatypes. Nullable datatypes are not Common Type System (CTS) compliant, but they can be used with .NET Generic classes if a component accepts or returns null arguments or if reference arguments are set to null.
Only include functions with supported datatypes Select this check box if you do not want to list functions that are not supported in the .NET environment. The functions will be listed in the Select Objects dialog box that you can open for the project from the Project painter.

After you create a .NET Assembly target, you can create as many .NET Assembly projects as you need. You start the .NET Assembly project wizard from the Project tab of the New dialog box. The fields in the wizard include all the fields in the table for creating a project from scratch, except for the �PowerBuilder object name� and �Description� fields. They also include all fields in the table for creating a project from an existing target, except for the �Choose a target� field.

Whether you opt to build a new target from scratch or from an existing target, most of the project-related fields listed in these tables are available for modification in the Project painter.


Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x