.NET Framework/C##
This guide provides step-by-step instructions for running a Dlubal API client on .NET Framework. Use this package when your project cannot target modern .NET — for example, a plugin or add-in hosted inside an existing .NET Framework application. For new projects targeting .NET 9 or higher, use .NET/C# Client instead.
Prerequisites#
Before you begin, ensure your system meets the following requirements:
Install the .NET Framework 4.8 Developer Pack.
This provides the targeting and reference assemblies required to build against
net48.It is included with Visual Studio when the .NET desktop development workload is selected.
Install a build toolchain — either:
Visual Studio (recommended on Windows), or
the .NET SDK, which lets you build SDK-style
net48projects from the command line withdotnet build.dotnet --version
(Optional) Install Visual Studio Code with the C# Dev Kit extension:
Open the Extensions view by pressing
Ctrl+Shift+X.Search for
C# Dev Kitand click Install.
Create a New Project#
Create a console application that targets .NET Framework 4.8.
In Visual Studio: choose Console App (.NET Framework) and select .NET Framework 4.8 as the target framework.
From the CLI (SDK-style project): create the project and set the target framework to
net48:dotnet new console -o DlubalApiSample
Then edit the generated
.csprojso it targetsnet48:<TargetFramework>net48</TargetFramework>
Install the Dlubal API Package#
Installing the NuGet package from the Terminal (CLI)
Open the Terminal in your project directory (press
Ctrl+`)Run the following command to install the Dlubal API package into your project.
dotnet add package Dlubal.Api.NetFramework
If you need to install a specific version of the package (for example, version 2.14.8), you can do so by appending the
--versionflag followed by the desired version number:dotnet add package Dlubal.Api.NetFramework --version 2.14.8
In Visual Studio you can instead use the Package Manager Console:
Install-Package Dlubal.Api.NetFramework -Version 2.14.8
Important
The API client version must match the version of your Dlubal application to ensure full compatibility. For example, API client version
2.14.8corresponds to RFEM6.14.0008/ RSTAB9.14.0008.Verify the Installation
Run the following command
dotnet list package
Ensure
Dlubal.Api.NetFrameworkappears in the list of installed packages.
Using the Package#
using System;
using Rfem = Dlubal.Api.Rfem;
using Common = Dlubal.Api.Common;
ApplicationRfem? rfemApp = null;
try
{
rfemApp = new ApplicationRfem();
Common.ApplicationInfo appInfo = rfemApp.get_application_info();
Console.WriteLine(appInfo);
// Create a new model
rfemApp.create_model(name: "my_first_model");
// Create a single node at coordinates [1.0, 2.0, 3.0] (in meters)
rfemApp.create_object(
new Rfem.StructureCore.Node
{
No = 1,
Coordinate1 = 1.0,
Coordinate2 = 2.0,
Coordinate3 = 3.0
}
);
Console.WriteLine("Created node No. 1.");
}
catch (Exception ex)
{
Console.WriteLine($"Error: {ex.Message}");
}
finally
{
if (rfemApp != null) rfemApp.close_connection();
}
For details on API key options and config.ini management, see the Authentication documentation.