Code Conversion from C/AL to AL

Before you start

Get familiar with the basics of setting up and developing in Visual Studio Code and AL, see Developing Extensions in AL.Also, review the Known Issues for information about issues that may affect the upgrade.

Đọc thêm

Breaking changes

When converting from C/AL to AL, it's important that you don't introduce any breaking schema changes to the database. Otherwise, you won't be able to synchronize the new extension with the database.

Đọc thêm

Task 1: Import the test library into your C/AL solution

If your solution uses Microsoft (1st-party) extensions, you'll have to convert the test library from C/AL to AL. The reason for this is that the Microsoft extensions rely on the test symbols. The easiest way is to import the CALTestLibraries.W1.fob file into the old database. This file is available on the version 14 installation media (DVD) in the TestToolKit folder.You can do this using the (Dynamics NAV Development Environment). For more information, see Exporting and Importing Objects.

Đọc thêm

Task 2: Compile all the objects in your C/AL solution

Compiling all the objects is a prerequisite for a successful and complete export. To compile objects, you can use either of the following tools:

Đọc thêm

Task 3: Export the application objects to the new TXT syntax

Once the application compiles, you must export all C/AL application objects, except system tables and codeunits (IDs in the 2000000000 range), to the new TXT format. The exported objects will be used as input to the Txt2AL conversion tool. To export objects, use the Export-NAVApplicationObject cmdlet of the Dynamics NAV Development Shell. it's important to:The Export-NAVApplicationObject cmdlet will export all objects to a single .txt file. If you imported the test library objects into the database, then you'll export the base application objects and the test library separately. Later, you'll create a separate AL project for each set of files.For example, do the following steps:

Đọc thêm

Task 4: Create a declaration file for custom .NET assemblies (optional)

If your solution contains .NET interoperability code and control add-ins, you can create a file that contains the declarations to the assemblies. This file will be used when you convert the C/AL TXT files to AL in the next step. Alternatively, after the conversion, you'll have to manually add the declarations to objects that use the assemblies.To create the file, use a text editor or Visual Studio code to create a file that contains the assembly declarations as follows:Save the file with any name and the extension .al, for example mydotnet.al. Make a note of the path because you'll use it in the next step.

Đọc thêm

Task 5: Convert the C/AL TXT files to AL

With C/AL exported to the new TXT format, you now convert the code to AL using the The Txt2Al Conversion Tool. The Txt2Al creates .al files for each object in the TXT files. Similar to Task 3, if you imported the test library objects into the database, then you'll convert the base application objects and the test library separately.

Đọc thêm

Get the Txt2AL conversion tool

The Txt2Al conversion tool (txt2al.exe) is only available with version 14, which is the last version to support C/AL. Use this version of the tool no matter what later version you may eventually be upgrading to. The AL objects created by the tool will be compatible with later versions.You find the txt2al.exe on the installation media (DVD) in the "DVDRoleTailoredClientprogram filesMicrosoft Dynamics NAV140RoleTailored Client" folder. Or, it's installed locally with Dynamics NAV Development Environment, for example, in the "C:Program Files (x86)Microsoft Dynamics 365 Business Central140RoleTailored Client" folder.

Đọc thêm

Run the Txt2AL conversion tool

Đọc thêm

Task 6: Create a new application database for development

To build your base application, you'll create a new application database on the Business Central platform version that you're upgrading to (like 18, 19, or 20). This will only be used during development.

Đọc thêm

Task 7: Create and build an AL project for custom base application

In this task, you'll create an AL project in Visual Studio code that you'll use for building your custom base application extension based on your converted C/AL application.

Đọc thêm

Task 8: Create and build an AL project for the test library

If you converted the test library form C/AL to AL, you'll now create and build a project for test library, similar to what you did for the base application.

Đọc thêm

Next Steps

If you're performing a technical upgrade from version 14.0, return to the technical upgrade step where you left off.

Đọc thêm

Related information

The Txt2Al Conversion Tool Developing Extensions AL Development Environment Page Extension Object Report Object Page Properties

Đọc thêm

Bạn đã thích câu chuyện này ?

Hãy chia sẻ bằng cách nhấn vào nút bên trên

Truy cập trang web của chúng tôi và xem tất cả các bài viết khác!

SachHayOnline.