# Getting Started

This guide describes the basic steps involved in converting a small PowerBuilder project to a C#/Angular web application.

## Requirements <a href="#requirements" id="requirements"></a>

This guide requires the following software packages:

* Visual Studio 2017 or 2019
* .NET Framework 4.6.1
* .NET Core 2.2 SDK
* NodeJS 12.9.\* (<https://nodejs.org/en/>)
* Angular-CLI (<https://cli.angular.io/>)
* Yarn (<https://yarnpkg.com/>)

The PBNet conversion tool is Windows executable. Get in touch with the team to get an appropriate build of the tool.

A simple migration could be performed using just the `-i` and `-o` command line arguments.

A PowerBuilder project is expected to be composed of a group of PB libraries (.PBL files) and assets such as images and configuration files. An important element to tie everything together is the target file (a .PBT file).

For example, say that the project to be converted is located in the path `C:\pbprojects\testproject1` . For a very simple project the contents of this directory may have something like this:

* testproject1.pbl
* testproject1.pbt
* testproject1.pbw
* testproject1.usr.opt

This is a simple project that when executed shows a simple window like this:

The current version of the conversion tool must be executed from the command line. The current directory must be the directory where the tool `Mobilize.PBNetMAP.ConversionTool.exe` was copied. For example:

```
C:\lastest_build\>
```

The `-i` command line argument is used to specify the path where the **target** file (`testproject1.pbt`) is located. The `-o` command line argument is used to specify the output directory . This path is going to have the converted C# project.

```
C:\lastest_build> Mobilize.PBNetMAP.ConversionTool.exe -i c:\pbprojects\testproject1 -o c:\pbprojects\converted
info: Migrator[0]
     TC0001: Starting Composition Import
info: Migrator[0]
     TC0003: Loading parts for category Rules
info: Migrator[0]
     TC0005: Loading file ..\Rules\net461\Mobilize.Rules.PowerBuilderToCSharp.dll
...
...
...
     HTMLGEN0004: Finish generating view w_main
info: Migrator[0]
     [2020.02.21 16:14:06] Finish Generation of Migrated Code
info: Migrator[0]
     [2020.02.21 16:14:06] Finish Migration
C:\lastest_build>
```

While running, the conversion tool shows many internal execution messages.

## The generated project <a href="#the-generated-project" id="the-generated-project"></a>

The output folder looks like this:

This output folder contains log files(`ConversionTool.Log...txt`), temporary migration folders (`repository`) and the generated C# solution in `MigratedSolution`.

The `MigratedSolution` contains one C# project (.CSPROJ) and directory per PowerBuilder library (.PBL) . Two additional projects are created for each migration:

* `AllInterfaces.csproj` contains interfaces for class definitions in all the libraries of the solution
* `testproject1Site.csproj` contains the website for the converted application.

## Executing the converted project <a href="#executing-the-converted-project" id="executing-the-converted-project"></a>

Two steps need to be performed for executing the converted project.

### 1. Compile the frontend <a href="#id-1-compile-the-frontend" id="id-1-compile-the-frontend"></a>

The compilation of the frontend components need to be executed from the command line. First run the `yarn install` command to install all the required third party packages (including Angular, Kendo UI, etc). Then compile the code using `ng build`.

For example:

```
C:\pbprojects\converted\MigratedSolution\testproject1Site\testproject1Site-angular> yarn install
arn install v1.13.0
[1/4] Resolving packages...
...
...
...
Done.
C:\pbprojects\converted\MigratedSolution\testproject1Site\testproject1Site-angular> ng build

Date: 2020-02-21T22:51:03.431Z
Hash: d9ed8a39693e87005cf1
Time: 73782ms
chunk {main} main.js, main.js.map (main) 51.8 kB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 384 kB [initial] [rendered]
chunk {polyfills-es5} polyfills-es5.js, polyfills-es5.js.map (polyfills-es5) 463 kB [initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 6.08 kB [entry] [rendered]
chunk {scripts} scripts.js, scripts.js.map (scripts) 86.1 kB [entry] [rendered]
chunk {styles} styles.js, styles.js.map (styles) 1.19 MB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 23.9 MB [initial] [rendered]
C:\pbprojects\converted\MigratedSolution\testproject1Site\testproject1Site-angular>
```

Downloading the packages and compiling the code may take a couple of minutes depending on the size of your project.

### 2. Build and execute the converted solution <a href="#id-2-build-and-execute-the-converted-solution" id="id-2-build-and-execute-the-converted-solution"></a>

The server side code needs to be compiled using Visual Studio 2017 or above. The solution is located in `MigratedSolution\MigratedSolution.sln` .

Compile and execute this project and execute this project to get


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.gapvelocity.ai/webmap/powerbuilder-to-.net/getting-started.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
