Hints for writing long-term stable code - TIAPortal

Readme TIA Portal Openness

ft:publication_title
Readme TIA Portal Openness
Product
TIAPortal
Version
V20
Publication date
01/2025
Language
en-US
Hints for writing long-term stable code

Version change

If you consider some hints for writing long-term stable code you will be able to use your application with other versions of the TIA Portal without modifying the code of your application.

Note

V* and *.ap* in document refer to the adapted path and extension according to the installed version of the TIA Portal.

Registry path and appconfig file

Modifications are necessary to change registry path and application configuration file, for instance:
“C:\Program Files\Siemens\Automation\Portal V14\PublicAPI\V14 SP1\Siemens.Engineering.dll”
has to be changed to
“C:\Program Files\Siemens\Automation\Portal V*\PublicAPI\V*\Siemens.Engineering.dll”

To write long-term stable code, the registry path should be configurable and the application configuration file must be updated.

Installation path

Modifications are necessary to change the installation path of TIA Portal, for instance:
“C:\Program Files\Siemens\Automation\Portal V14\PublicAPI\V14 SP1\Siemens.Engineering.dll”
has to be changed to
“C:\Program Files\Siemens\Automation\Portal V*\PublicAPI\V*\Siemens.Engineering.dll”

To write long-term stable code, the installation path should be configurable.

Extensions of TIA Portal project files and libraries

Modifications are necessary to change the extensions of TIA Portal project file and of libraries, for instance:
*.ap14
has to be changed to
*.ap*

To write long-term stable code, the extensions of TIA Portal project files and libraries should be configurable.

Opening a project

To write long-term stable code, the Projects.OpenWithUpgrade method should be used instead of the Projects.Open method.

Hierarchy of results

The hierarchy and/or the order of result classes e.g. compile result, might change across versions.

To write long-term stable code, you should avoid making assumptions about the depth and order of specific results.

The class layout is actually considered long term stable, mention explicit type names CompilerResult, CompareResult, DownloadResult, UploadResult. There is also a new results class: TransferResult. Content, hierarchy and order follow what is presented on the TIA Portal user interface of the currently executed or installed TIA Portal.