Skip to main content

Converting Projects from CODESYS 4 for CODESYS 3

In this section, you will import a library from CODESYS 4 to CODESYS 3.

Importing a compiled library

Requirement: The library project is open in CODESYS 4 and it can be compiled without errors.

  1. In the workspace navigator, select the library project.

  2. In the context menu, select the Save Compiled Library command.

    The Save Compiled Library <library name>.fbslib dialog will open.

  3. Choose the destination path.

  4. In the list box, select the Compiler target version which matches your CODESYS 3 installation.

  5. Click the Overwrite existing button to start the saving process.

  6. In CODESYS 3, install the file in the library repository and reference the library in the library manager.

The compiled library will be used in CODESYS 3. The source code will not be included.

Importing a source library

  1. All library references in the project are specified in a form which is supported by CODESYS 3. First check the following.

    1. Check the Libraries.json file for relative path references. A library which is referenced via a relative path cannot be resolved in CODESYS 3. Replace these references if necessary.

    2. Check the reference versions. A valid CODESYS 3 version has one of the following forms:

      • A 2 to 4-part semver (example: 3.5.17.0)

      • A placeholder as the last component (example: 3.5.*)

      • The value = for the same version as the container

  2. Now check that all objects are written in structured text.

  3. Save the library project in CODESYS 4 and then close the IDE.

  4. Open CODESYS 3.

  5. Open the project. You have the following alternatives:

    • In CODESYS 3, select the File → Open command and then choose the desired FBSWS file in the file selection dialog.

    • Select the Open Project Folder command and then choose the desired FBSLIB file in the dialog that opens.

      Tip

      The command is not available in the menu by default. You can use the Customize dialog to add the command to your menu. The command is located in the File-Based Storage category.

      The library will open. A new object GUID will be generated for each object. By default, it is assumed that the objects do not have any properties.

  6. You can share the library as a single file if needed.

    • To do this, select the Pack Library Archive command in CODESYS 3.

      The library is packed into an FBSLIBPACK file which you can share.

    • In CODESYS 4, run the following CLI command to create a packed source library:

      c4-cli library pack <library path>

Common problems

Problem

Fix

The library opens in read-only mode and a notification is displayed in the notification view.

The library uses a relative path reference or a reference version which cannot be displayed in CODESYS 3. Write protection prevents the original files from being overwritten. Fix this in CODESYS 4.

An object is missing in CODESYS 3.

The object is not written in structured text.

The library opens in read-only mode, and a notification about a missing license is displayed in the status field.

There is no valid license for file-based storage. Install a valid license.

An object cannot be loaded or saved.

The file still contains conflict tags from version control system. Resolve the conflict in the file and remove all tags.

The compiled library is rejected.

The target version of the compiler does not match the CODESYS 3 installation. Repeat the save process with the matching target version.