Problem Overview
The Siemens application example "TIA Openness Library Compare" (entry ID 109749141) is a C# utility that automates the comparison of project libraries and global libraries between two TIA Portal projects. The published binary targets TIA Portal V13/V14 and binds to Siemens.Engineering.dll at version 14.0.1.0. When you run the tool against TIA Portal V16 or V17 installations, it throws a reflection loading exception and never reaches the compare engine.
The error appears immediately after the project selection dialog closes, before the compare progress bar renders. The tool cannot continue without a code rebuild that targets the new TIA Portal Openness API surface and registry layout.
Error Symptoms and Stack Trace
The full type-load failure returned to the GUI is:
Could not load type 'Siemens.Engineering.UmacDelegate' from assembly
'Siemens.Engineering, Version=14.0.1.0, Culture=neutral, PublicKeyToken=d29ec89bac048f84'
Secondary symptoms reported in the field:
- Similar failures for
Siemens.Engineering.ProjectBasewhen the user attempts V15.1 with a V15.1-targeted build (Version=15.1.0.0 missing types). - File enumeration in
Openness.csfails to recognize.ap16and.ap17archive extensions and silently skips project folders. - Missing NuGet packages (
Microsoft.Expression.Interactions) prevent the Release build from completing.
UmacDelegate type belongs to the User Management and Access Control (UMAC) namespace of the Openness API. The type is registered in V14/V15 Openness but its definition shifted when V16 introduced the unified Umac configuration model. A binding redirect or version swap is required.Root Cause Analysis
The application example ships with a static switch statement in Resolver.cs that maps a detected TIA Portal version to:
- Display version string (
V13,V14,V15,V15.1). - TIA Portal internal build number (
13.00.0000,14.00.0000,15.00.0000,15.01.0000). - Global library subfolder.
- STEP 7 and Openness registry paths under
SOFTWARE\Siemens\Automation\_InstalledSW\TIAPxx.
Entries for V16 and V17 are missing. Without a case branch for the installed TIA Portal, the resolver falls back to the V14 binding, and at runtime the Common Language Runtime attempts to materialize UmacDelegate from Siemens.Engineering 14.0.1.0, which does not contain the type signature expected by the V14-targeted IL. The assembly loader then throws the TypeLoadException shown above.
Two further compounding issues exist in the example source:
- The
LibraryCompare.Opennessproject referencesSiemens.Engineering14.0.1.0 by NuGet fallback; it must be repointed to theSiemens.Engineering.dllshipped with TIA Portal V14 SP1 (or higher) and markedCopy Local = falseso the GAC-shipping Openness assembly is loaded at runtime. - The file filter in
Openness.csuses an exact match on.ap14, which excludes V16 (.ap16) and V17 (.ap17) project archives.
Prerequisites
Confirm the following before modifying the source:
- Microsoft Visual Studio 2017 or 2019 with the .NET desktop development workload installed.
- .NET Framework 4.8 Developer Pack (required for the project assemblies).
- TIA Portal V16 with Openness installed (or V16 and V17 both present for multi-version compare).
- Siemens TIA Portal Openness V14 SP1 DLL set (the reference DLL family) extracted to a known folder, or the DLLs copied from
C:\Program Files\Siemens\Automation\Portal V14 SP1\PublicAPI\V14 SP1. - Local administrator rights so the rebuilt tool can read the
SOFTWARE\Siemens\Automation\_InstalledSW\TIAPxxregistry hive. - NuGet access for
Microsoft.Expression.Interactions(typically restored automatically by Visual Studio).
Step-by-Step Solution
1. Open the Source Solution
Extract the downloaded ZIP 109749141_TIA_OpennessLibraryCompare_PROJ_V13.zip to a working directory and open:
109749141_TIA_OpennessLibraryCompare_PROJ_V13\LibraryCompare-SourceCode\Open LibraryCompare.sln
Visual Studio will load three projects: LibraryCompare.GUI, LibraryCompare.Core, and LibraryCompare.Openness.
2. Update the Resolver Switch Statement
In the Solution Explorer, expand LibraryCompare.Core and open Resolver.cs. Locate switch in the Resolve method (line 123 in the published source). Insert two new case branches before the default block:
case "16.0":
_versionString = "V16";
_tiaVersionNumber = "16.00.0000";
_subFolder = "V16";
_step7Registry32Bit = "SOFTWARE\\Siemens\\Automation\\_InstalledSW\\TIAP16\\STEP7";
_step7Registry64Bit = "SOFTWARE\\Wow6432Node\\Siemens\\Automation\\_InstalledSW\\TIAP16\\STEP7";
_opennessRegistry32Bit = "SOFTWARE\\Siemens\\Automation\\_InstalledSW\\TIAP16\\TIA_Opns";
_opennessRegistry64Bit = "SOFTWARE\\Wow6432Node\\Siemens\\Automation\\_InstalledSW\\TIAP16\\TIA_Opns";
break;
case "17.0":
_versionString = "V17";
_tiaVersionNumber = "17.00.0000";
_subFolder = "V17";
_step7Registry32Bit = "SOFTWARE\\Siemens\\Automation\\_InstalledSW\\TIAP17\\STEP7";
_step7Registry64Bit = "SOFTWARE\\Wow6432Node\\Siemens\\Automation\\_InstalledSW\\TIAP17\\STEP7";
_opennessRegistry32Bit = "SOFTWARE\\Siemens\\Automation\\_InstalledSW\\TIAP17\\TIA_Opns";
_opennessRegistry64Bit = "SOFTWARE\\Wow6432Node\\Siemens\\Automation\\_InstalledSW\\TIAP17\\TIA_Opns";
break;
The registry layout matches what TIA Portal V16 and V17 installers write under HKLM. The 32-bit entries remain because legacy installers (and 32-bit Openness probes) still write them, while the 64-bit equivalent lives under the WOW6432Node reflection hive.
3. Repoint the Openness DLL Reference
Open the LibraryCompare.Openness project and remove the existing Siemens.Engineering assembly reference. Add a new reference, browse to the V14 SP1 PublicAPI folder, and select Siemens.Engineering.dll (version 14.1.0.0 or matching the V14 SP1 install). After adding the reference, set the following properties in the Visual Studio Properties window:
| Property | Value |
|---|---|
| Copy Local | False |
| Specific Version | False |
| Embed Interop Types | False |
Open the build output folder (bin\Release) of LibraryCompare.Openness and delete any Siemens.Engineering.*.dll files copied in by an earlier build. The runtime must load the GAC-installed version of the assembly that ships with the active TIA Portal.
4. Target .NET Framework 4.8
For each of the three projects (LibraryCompare.GUI, LibraryCompare.Core, LibraryCompare.Openness):
- Right-click the project and choose Properties.
- Open the Application tab.
- Set Target framework to
.NET Framework 4.8. - Save the project file.
Visual Studio will prompt to retarget; accept and rebuild. .NET 4.8 is required because the rebuilt tool uses async I/O patterns and modern C# features not available in 4.5/4.6.
5. Patch the Archive Extension Filter
Open Openness.cs in LibraryCompare.Openness and navigate to line 232. The original guard is:
if (fileInfo.Extension == ".ap14")
Replace it with a contains check that matches all TIA Portal archive generations:
if (fileInfo.Extension.Contains(".ap1"))
This pattern matches .ap13, .ap14, .ap15, .ap16, and .ap17. If you need to restrict to a specific generation, replace with explicit Or clauses for each extension.
6. Restore NuGet Packages
If the build fails with a missing reference to Microsoft.Expression.Interactions, restore via:
Tools > NuGet Package Manager > Package Manager Console
PM> Update-Package -reinstall
or right-click the solution and choose Restore NuGet Packages. The Expression Interactions assembly is required by the WPF binding glue in LibraryCompare.GUI.
7. Build the Release Binary
From the Visual Studio menu:
- Build > Clean Solution to remove stale intermediate output.
- Set the solution configuration to Release in the toolbar dropdown.
- Build > Build Solution (Ctrl+Shift+B).
The output binary lives at LibraryCompare.GUI\bin\Release\LibraryCompare.GUI.exe. Copy the entire Release folder to a deployment location and launch the executable as administrator.
Verification
Validate the rebuilt tool with the following checks:
-
Project load test: Open two TIA Portal V16 projects (or V16 vs V17) using the "Load Project" dialog. The browser must list
.ap16archives. - Compare execution: Click Start Comparison. The progress bar should reach 100% and the compare editor should display block-level diffs.
-
Registry probe: With the tool running, attach Process Monitor (ProcMon) and filter for
RegOpenKeyonTIAP16orTIAP17. Successful keys should be queried, missing keys should produce a graceful "TIA Portal not installed" message rather than a crash. - Cross-version regression: Run the tool on a TIA Portal V15.1 project to confirm that the original V15.1 branch of the switch statement still functions.
Native TIA Portal Library Compare Alternative
If rebuilding the C# tool is not feasible, TIA Portal provides a built-in compare editor that does not require any Openness code. According to the Siemens FAQ 81748055 and the TIA Portal V20 documentation:
- Enable the Reference projects view via View > Reference projects in the Project tree.
- Open the first project as the active project.
- Open the second project as a reference project.
- Open the Libraries task card, right-click the project library or global library, and select Start comparison.
- Use the compare editor to step through added, deleted, and modified library elements.
The built-in compare editor is available in TIA Portal V15.1 and later, and supports offline/offline project comparison as well as project-to-library and library-to-library comparison without any external tooling.
Troubleshooting Matrix
| Symptom | Likely Cause | Resolution |
|---|---|---|
UmacDelegate TypeLoadException |
Openness DLL bound to V14 | Repoint reference to V14 SP1 DLL with Copy Local = False; add V16/V17 resolver cases |
ProjectBase TypeLoadException on V15.1 |
Resolver missing 15.1 entry or DLL not GAC-registered | Add or correct case "15.1" branch; reinstall TIA Portal V15.1 with Openness option |
| No projects appear in the file browser | Extension filter rejects .ap16/.ap17
|
Patch Openness.cs line 232 to use Contains(".ap1")
|
Build fails: Microsoft.Expression.Interactions missing |
NuGet cache empty or offline | Restore NuGet packages; verify internet access or use local feed |
| Tool crashes on launch with FileNotFoundException | Siemens.Engineering.dll copied into Release folder | Delete all Siemens.Engineering.* DLLs from Release output; rely on GAC binding |
| Compare runs but reports no differences | Library master copies identical or both empty | Inspect .GlobalLibrary folder inside each project; confirm versions differ in V16 project view |
| Access denied reading registry | Non-admin user | Right-click the executable and choose Run as administrator |
Field-Proven Caveats and Edge Cases
Several practical considerations apply when deploying the rebuilt tool on a production engineering workstation:
- Multi-version workstations: If a single machine hosts TIA Portal V15.1, V16, and V17, the tool will resolve to the highest version that matches the registry scan order. To force a specific version, close all higher-version TIA Portal instances and rename the corresponding registry hive temporarily.
-
User administration differences: The
UmacDelegateerror is sometimes caused by mismatched UMAC (User Management and Access Control) configurations between the two projects being compared. Ensure both projects use the same user administration mode (local Windows users vs TIA project users). - Project password protection: TIA Portal V16 project archives that are password-protected will not be loadable by the Openness API. Remove password protection before running the compare.
- Library version conflicts: The compare result highlights block-level differences but does not perform automatic merge. Use the TIA Portal compare editor to accept or reject individual changes.
FAQ
What is the Siemens.Engineering.UmacDelegate type, and why is it missing in TIA Portal V16?
UmacDelegate is part of the TIA Portal Openness user-management API in V14/V15. Starting with TIA Portal V16, the UMAC configuration was restructured and the delegate was renamed or relocated in the assembly. Binding to the V14 DLL therefore triggers a TypeLoadException when the runtime looks for the legacy type.
Is a separate Openness installation required to run the rebuilt tool?
Yes. TIA Portal V16 with the Openness option selected during installation is mandatory. The Openness package registers Siemens.Engineering.dll in the GAC and writes the TIAP16 registry hive; the rebuilt tool relies on both.
Can the same binary compare V15.1, V16, and V17 projects?
Yes, provided the source code includes resolver entries for each version, the .NET Framework is 4.8, and Siemens.Engineering.dll is loaded from the GAC. Each project must be opened with the TIA Portal version that created it, and the binary is launched in the matching TIA Portal context.
Why does the file filter need to change from .ap14 to .ap1?
TIA Portal stores each project as a numbered archive: .ap13, .ap14, .ap15, .ap16, .ap17. The published source uses an exact match on .ap14, which silently excludes all later generations. The .Contains(".ap1") patch matches every TIA Portal archive family without further code changes.
Does the built-in TIA Portal compare editor make this tool obsolete?
For interactive single comparisons, the built-in editor is faster and more stable. The Openness-based tool remains valuable for batch comparison, scripted regression testing, and CI/CD pipelines where the compare operation must run unattended against many project pairs.