Skip to main content

Command: Resolve Libraries, Resolve All Libraries

Function: The command resolves the library references and stores the references in the Libraries.lock.json file.

Call: Right-click the Libraries.json item or the Libraries.lock.json item.

  • Context menu of the Libraries.json item

  • Context menu of the Libraries.lock.json item

Library resolution refers to the process of recursively analyzing all library references of the application and libraries. The complete dependency graph is created and saved in the Libraries.lock.json file during this process.

The compiler uses only the contents of the Libraries.lock.json file in order to load library references. Library resolution is triggered once when a device project is created and after that only by explicit user interaction. As a result, the dependency graph never changes for an existing project without explicit user interaction.

. A resolution of the libraries is necessary:
  • After editing the Libraries.json file

  • After editing or replacing devices

  • After changing a library version

Important

The Libraries.lock.json file and the hash make sure that the referenced libraries remain the same across different builds – not just their IDs, but also their contents.

The Resolve Libraries command re-resolves only those libraries whose references have changed, for example because they have been newly added. Libraries which have already been resolved remain in the version which is stated in Libraries.lock.json. This allows individual libraries to be added or updated without changing the other references.

The Resolve All Libraries command always re-resolves all references and ignores the Libraries.lock.json file if it exists.

. Priority for library resolution:
  1. Libraries which are referenced with a relative path are resolved by the path.

  2. Library references with fixed version library IDs are resolved to that fixed version.

  3. Library references with a version pattern are resolved to the latest version of that library which matches the pattern.

  4. Placeholders for libraries with a placeholder override in the top level of Libraries.json are resolved according to the override.

  5. Placeholders, for which a component in CODESYS 4 or an extension defines a placeholder resolution, are resolved to this version.

  6. Placeholders with a unique resolution in the existing device descriptions are resolved according to the placeholder definitions in the device descriptions. (XML path: library-management\\placeholder-libraries\\)

  7. Required libraries which are unresolved will trigger an error.