Tekla Open API 2024 upgrade: why your exe stops connecting

Your tool worked on 2023. You retarget it to 2024, press F5, and it can’t connect. Tekla is running, the model is open, and GetConnectionStatus() still says false.

That’s what I got when I moved my own tools to 2024. Nothing was wrong with the code. What had changed was where Windows finds Tekla’s DLLs.

2024 took the Open API out of the GAC

Tekla’s 2024 Open API release notes say it in one line: Open API assemblies are no longer registered to the Global Assembly Cache. Up to 2023, any exe on the machine could ask for Tekla.Structures.Model.dll and .NET handed it the installed one from the GAC. From 2024 there’s no GAC copy. Your exe loads whatever it finds next to itself, and in a default project that’s the copy NuGet dropped into bin\Debug.

Tekla’s developer docs describe exactly this: a new 2024 app built the default way, run from Visual Studio, can throw a connection error. The same release also made .NET Framework 4.8 the minimum and removed COM support from the Open API assemblies.

Ask the exe which Tekla DLL it really loaded

Before you change anything, print where the Model assembly came from. Two lines settle the question.

using System;
using Tekla.Structures.Model;

var asm = typeof(Model).Assembly;
Console.WriteLine($"{asm.GetName().Version}  {asm.Location}");   // must be inside the Tekla install, not bin\Debug

var model = new Model();
if (!model.GetConnectionStatus())
{
    Console.Error.WriteLine("No connection. Is the same Tekla version running, with a model open?");
    return 1;
}

// ... the tool's real work ...
return 0;

If the path points at your own build folder, you’re running NuGet’s copies, not Tekla’s.

The fix is an exe.config, and Tekla ships the tool that writes it

The exe has to be told where the installed Tekla keeps its DLLs. That’s a codeBase entry per assembly in the exe’s config file, and nobody should write those by hand. Tekla publishes a NuGet package for it, TSAppConfigPatcherTask. At build time it adds an entry for every DLL that used to live in the GAC and points each one at the Tekla version you name. Tekla’s own docs offer a Directory.Build.props download that does the same job.

<PropertyGroup>
  <!-- Debug only: the patcher points the exe.config at THIS machine's Tekla -->
  <TeklaVersion Condition="'$(Configuration)' == 'Debug'">2024.0</TeklaVersion>
</PropertyGroup>

<ItemGroup>
  <!-- compile against it, never copy it: Tekla provides the real DLL at runtime -->
  <PackageReference Include="Tekla.Structures.Model" Version="2024.0.*" ExcludeAssets="runtime" />
  <PackageReference Include="TSAppConfigPatcherTask" Version="2.1.3" />
  <!-- ExcludeAssets also strips System.Memory, which the exe still needs beside it -->
  <PackageReference Include="System.Memory" Version="4.5.5" />
</ItemGroup>

Leave out that last line and the exe gets further, then dies with Could not load file or assembly 'System.Memory, Version=4.0.1.2'. Same cause, one level down: you told NuGet not to copy runtime DLLs, and it obeyed.

Why Debug only: the trap my AI agent walked into

My agent built the exe in Release. Reasonable guess for a “finished” tool. Wrong. With the condition above, Release has no TeklaVersion, the patcher skips the config, and the exe doesn’t start.

The gate is there on purpose. The patched config contains your Tekla’s install path. Ship it and it breaks on the first colleague’s machine with Tekla installed somewhere else. The Release build goes into the .tsep instead, and for apps placed in the extensions folder, Tekla writes the correct exe.config itself when it starts. Debug runs on your machine. Release runs on everybody else’s.

The NuGet version must be the Tekla that’s running

A tool built against the 2025 packages doesn’t talk to a running 2024, and the other way round. The Open API connects over a channel whose name carries the Tekla version, so a mismatch looks exactly like “Tekla isn’t running”: false, no exception. If your detailers sit on two versions during a project, that’s two builds. Keep the version in one property and build each one from the same code.

What else moved between 2021 and 2026

VersionChangeWhat you notice
2021The single TeklaOpenAPI package is replaced by separate Tekla.Structures.* packagesOld package references stop resolving for 2021+
2022bin\plugins is no longer supported for custom plug-insThe plug-in is missing from Applications & components. Deploy to the extensions folder.
2024No GAC, .NET Framework 4.8 minimum, COM removedThe exe can’t connect from Visual Studio. Older target frameworks don’t compile.
2026Only 64-bit .tsep extensions are supportedTekla converts “32-bit preferred” extensions on its own. XS_SKIP_CONVERTING_EXTENSION_APPS_TO_X64 turns that off.

Tekla is a 64-bit process, so build x64 whatever the version. A 32-bit plug-in doesn’t load at all, and a 32-bit exe dies at startup with BadImageFormatException.

Before you retarget the next version

  1. Print typeof(Model).Assembly.Location. It must point into the Tekla install.
  2. Tekla packages as ExcludeAssets="runtime", plus System.Memory in every exe.
  3. TSAppConfigPatcherTask with TeklaVersion set in Debug only.
  4. Package Release builds as .tsep. Never ship a patched config.
  5. NuGet major = installed Tekla major, and x64 always.

A solved problem before line one. After my agent’s Release slip, the project template in the Tekla Open API skill got the patcher, the Debug-only gate and the System.Memory line baked in, and one property that sets the Tekla version for every package. In the course you scaffold your first tool from that template, so the 2024 setup is already in the project instead of waiting for you behind a connection error. Build it in Debug (Visual Studio, or dotnet build -c Debug) and the exe finds Tekla, and moving to the next version means editing one number.

Tekla Open API Course: build real Tekla tools with an AI agent →

Related: Debug a Tekla plug-in in Visual Studio · GetReportProperty: types, units and the silent false · Tekla UDAs from C#: why GetUserProperty returns false

Tags

Greg Olszewski

Greg Olszewski builds Tekla Open API tools: Grasshopper Tekla Drawing Link, Smart Select, Tekla Lookup. Ten years of C# on Tekla Structures, day job in precast. Now he teaches engineers to build their own.

About Greg ›

COURSE

Build your own Tekla tools

Learn the Tekla Open API in C#, from your first plug-in to tools your team actually uses.

See the course ›