Sample Exporter wich uses the TiaFileFormat DLL
This Project is mostly a Demo on how to use the Library. But it also can be used to export many parts of a TIA Project to different Files. But you can also use the C# objects directly.
The tool should work on every OS where dotnet is supported.
The default build uses the published TiaFileFormat and BaseHmiTypes
NuGet packages. Build with
dotnet build src/Exporter/TiaFileFormatExporter.csproj.
To compile and use the adjacent library checkouts instead, pass -p:UseLocalLibraries=true.
For a full license, supply its path with -p:TiaLicensePath="C:\path\to\license.license";
the build copies it to the output as tiafileformat.license instead of the bundled demo license.
dotnet TiaFileFormatExporter.dll "TiaProject.ap20" --plcblock --out "d:\export"
The TIA Project can be in a Folder, or you can also directly export a compressed project.
Unpacked global libraries (.alxx) and archived global libraries (.zalxx) are
also accepted for every TIA version supported by TiaFileFormat. A standalone
library is exported automatically; select the desired object types as usual:
dotnet TiaFileFormatExporter.dll "GlobalLibrary.zal20" --plcblock --out "D:\export"
dotnet TiaFileFormatExporter.dll "GlobalLibrary.al15_1" --all --out "D:\export"Output is written below <input name>/Library. For an unpacked library, keep
the .alxx file with its accompanying System directory. --lib includes the
library embedded in a project, and --all includes both project and library
objects. The archive loader has no version-specific AL/ZAL extension whitelist.
Compatibility is opt-in, so existing invocations and output defaults remain unchanged. The following command exports PLC blocks, data types, tag tables, text lists, and force tables with the same directory structure and normalization used by TiaGitHandler:
TiaFileFormatExporter.exe "D:\path\Project.ap19" `
--out "D:\path\export" `
--tia-git-handler-compatibleFor lower memory use and the best measured throughput on large projects, add:
--indexed --prioritize-large-objects --max-parallelism 6 --no-cache --stream-automation-xml
The equivalent migration from the command-line TiaGitHandler defaults is:
# Existing command; output is written below the current working directory.
TiaGitHandler.exe "D:\path\Project.ap19" false true
# Replacement; the output directory is explicit.
TiaFileFormatExporter.exe "D:\path\Project.ap19" `
--out "D:\path\export" `
--tia-git-handler-compatible `
--indexed --prioritize-large-objects --max-parallelism 6 `
--no-cache --stream-automation-xml--indexeduses a supported TIA database index for lazy object loading. Missing and legacy indexes fall back to the sequential reader automatically, while malformed indexes still fail. The indexed reader can also be disabled simply by omitting this flag, including for unpacked projects.--prioritize-large-objectsstarts larger project objects earlier to reduce the parallel tail.--max-parallelism <n>limits concurrent object exports.0preserves the existing unbounded behavior. Positive values use a fixed worker pool and a bounded queue, so traversal waits for capacity rather than allocating a waiting task for every object.--no-cachedisables the converted-object cache to reduce retained memory.--no-segment-cacheadditionally reduces retained blob buffers when using--indexedand a compatible library version. Segment data is reread on demand, so this trades export speed for a smaller memory footprint. Sequential loading retains its existing behavior.--stream-automation-xmlwrites PLC XML directly to the destination stream instead of first constructing a complete in-memory string.
Individual PLC XML exports include full interface defaults. Deeply nested FB/UDT
interfaces can therefore produce very large files even with streaming enabled.
Add --omit-empty-inherited-type-children to omit inherited branches without
instance values or comments. This changes the XML contents; leave it off when
fully expanded default declarations are required. Combine it with
--max-parallelism 2 --no-cache --stream-automation-xml to limit retained data
during a bulk PLC export.
--all applies these bulk settings automatically: up to two export workers
(limited by the available processors), no
converted-object cache, and streaming PLC XML. Full inherited interface
declarations remain enabled. Explicit --max-parallelism values override the worker
default, including 0 for unbounded execution. All supported object categories,
the embedded library, hardware AutomationML and cross-references are still
exported. XML omission switches only apply when explicitly requested.
Individual export flags keep their existing defaults.
The default worker limit reduces competition between large sequential XML writes
and bounds the number of expanded interfaces held concurrently. Use
--max-parallelism to tune throughput for other storage and workloads.
With bounded workers, --all schedules objects by estimated expanded interface
size, including repeated type references, so expensive exports start earlier.
The estimates are cached during traversal and only affect execution order.
Snapshot exports retain their existing scheduling to preserve image dependencies.
Full PLC XML also reuses unchanged inherited declarations during serialization;
this preserves every declaration and the output formatting.
TiaFileFormatExporter.exe "input.zap18" --all --out "output"
The console reports object, AML and cross-reference stage times separately.
Add --no-aml and/or --no-xref to disable those exports entirely. These
exclusions override --all and explicit --aml/--xref selections:
TiaFileFormatExporter.exe "input.zap18" --all --no-aml --no-xref --out "output"
Also add --omit-empty-inherited-type-children when compact PLC XML is desired.
The metadata exclusions themselves preserve full PLC interface XML.
The Options to export are:
- --all - export everything the program supports using the bulk settings above
- --aml - project devices and networks as AutomationML
- --xref - project cross-references as JSON
- --plcblock - PLC Blocks (DB, FB, FC, ...)
- --plctagtable - PLC tag tables as csv
- --images - images
- --base64images - embed images in screen HTML as base64 data URIs
- --hmitagtable - HMI tag tables as csv
- --plcwatchtable - PLC watchtables as csv
- --winccscript - WinCC Scripts (vb, js, c)
- --wincctagtable - WinCC Tag Tables as CSV
- --screens - export WinCC/WinCCUnified screens as HTML
- --snapshot - generate a Image of the Screen HTML via Chrome
For a self-contained screen HTML export, use --screens --base64images. The existing
--images option exports project images as separate files instead.
For device AML and cross-reference exports, use:
dotnet TiaFileFormatExporter.dll "TiaProject.ap20" --aml --xref --out "d:\export"These exports write Project/Devices.aml, Project/Devices.diagnostics.json, and
Project/CrossReferences.json beneath the project output folder. AML contains all
convertible project devices and their networks; its diagnostics file lists skipped
devices and conversion messages. Cross-reference JSON contains objects, relations,
locations, addresses, and completeness diagnostics, with catalog IDs linking records.
It uses the project's XRef database when available and otherwise scans project data;
the JSON records the source and any fallback diagnostics. Both exports run with
--all, honor --noprojectname and --replacepath, and are regenerated on each run.
With a compatible library version, cross-reference export avoids catalog query indexes
and retained relation records. It prepares identities and counts, then streams JSON
directly from its SQLite snapshot. Older versions use the catalog export path.
This demo project is MIT licensed. The TiaFileFormat DLL has a proprietary license and needs to be obtained separately.