C# Client#
This guide provides step-by-step instructions for developing and running a Dlubal API client.
Prerequisites#
Before you begin, ensure your system meets the following requirements:
Install the .NET Core SDK (version .NET 8.0 or higher).
You’ll need the .NET SDK to install and use NuGet packages in a .NET-based project.
Verify the installation by running:
dotnet --version
Install Visual Studio Code as your code editor (for free).
Verify the installation by running:
code --version
Install C# Dev Kit extension in VS Code:
Open the Extensions view by pressing
Ctrl+Shift+X
.Search for
C# Dev Kit
and click Install.
Create a New Project#
Open Visual Studio Code.
Create a New Project with the
C# Dev Kit
installed:Open the Command Palette by pressing
Ctrl+Shift+P
Type
.NET: New Project...
and select it from the list.Choose Console App or another project type from the options.
Follow the prompts to select a project template, the target framework, and the location to create the project.
Openining the Project
Once the project is created, VS Code will automatically open the folder containing your project, so you can start working directly on it.
Install the Dlubal API Package#
Installing 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
If you need to install a specific version of the package (for example, version 2.10.8), you can do so by appending the
--version
flag followed by the desired version number:dotnet add package Dlubal.Api --version 2.10.8
Important
Ensure that the version of the API client corresponds to the version of the Dlubal application you’re using. This ensures full compatibility between the API client and the application.
Verify the Installation
Run the following command
dotnet list package
Ensure
Dlubal.Api
appears in the list of installed packages.
Using the Package#
using Dlubal.Api.Rfem;
ApplicationClient rfemApp = new ApplicationClient(
apiKeyValue: "your_api_key_value"
);
ApplicationInfo applicationInfo = await rfemApp.get_application_info();
Console.WriteLine("Version: " + applicationInfo.Name);