---
title: .NET
summary: Install the .NET SDK (BIMworks.Sdk, generated from the OpenAPI) or the classic BIM.works_SDK package from nuget.org or the BIM.works feed, including pre-release versions, and check that it connects.
order: 30
languages: [csharp]
terms: [sdk, api-token]
see-also: [reference/sdk/dotnet, reference/dotnet, reference/sdk, how-to/install/java, how-to/install/downloads, how-to/auth/log-in-with-an-api-token, tutorials/dotnet/quick-start]
notion: https://bimbase.notion.site/NuGet-Net-16759e23a38946f696e8d1dddfdf9be4
---

# .NET

For .NET developers. There are two .NET [[term:sdk|SDKs]], both public on nuget.org, so no registry credentials are needed ([[page:reference/sdk]] compares them):

- the **.NET SDK**, `BIMworks.Sdk`, generated from the OpenAPI document. Use it for a new integration; its reference is [[page:reference/sdk/dotnet]].
- the **classic .NET SDK**, `BIM.works_SDK`, the hand-written client of the task API; its reference is [[page:reference/dotnet]], and [[page:tutorials/dotnet/quick-start]] is a first program.

## The .NET SDK {#sdk}

`BIMworks.Sdk` targets .NET 8 and .NET Standard 2.0, and brings `Microsoft.Extensions.Hosting` and `.Http` with it. Its examples are console programs for the .NET 8 SDK:

```shell {#sdk-cli}
dotnet new console -n BimWorksExample
cd BimWorksExample
dotnet add package BIMworks.Sdk --version 3.0.0-beta.192
```

To check the installation, put the program below in `Program.cs` and `dotnet run` it; it logs in with your [[term:api-token|API token]] and prints the UUID of your root node. Every example of the .NET SDK has these four steps ([[page:reference/sdk/dotnet#example-shape]]).

```sdk-example {#check-sdk}
operation: GetRootNodeUuid
languages: csharp
```

Pre-release versions and the BIM.works feed work as for the classic package below; map `BIMworks.Sdk` to the feed in the same way.

## The classic SDK {#classic}

### Before you start

- A project that targets **.NET Standard 2.0** or anything that consumes it: .NET Core 2.0 and later, .NET 5 and later, or .NET Framework 4.6.1 and later.
- The package's one dependency, `System.Text.Json` 8.0.5 or newer, is pulled in by NuGet.

### 1. Add the package

The package id is `BIM.works_SDK`. Use the version that matches your BIM.works server (the version pill at the top of this page is the server's); pick one of the three ways:

```shell {#dotnet-cli}
dotnet add package BIM.works_SDK --version 3.0.0-beta.192
```

```text {#package-manager}
Install-Package BIM.works_SDK -Version 3.0.0-beta.192
```

```xml {#package-reference}
<PackageReference Include="BIM.works_SDK" Version="3.0.0-beta.192" />
```

### 2. Allow pre-release versions

Beta versions carry a `-b.<n>` suffix (`3.0.0-b.38`), and NuGet hides those unless you ask for them:

- **Visual Studio**: tick *Include prerelease* in *Manage NuGet Packages*.
- **Package Manager Console**: add `-IncludePrerelease` to `Install-Package` and `Update-Package`.
- **dotnet CLI**: add `--prerelease` to `dotnet add package`, or name the exact version as above.

```note
The package can also be downloaded as a `.nupkg` from a BIM.works instance that has the [[feature:DOWNLOAD_BUILDS]] feature, see [[page:how-to/install/downloads]]. Use it only for machines without access to nuget.org.
```

### 3. Or take it from the BIM.works feed

nuget.org is the main place for the package. If you would rather take every BIM.works SDK from one place with one set of credentials, the same versions are also on the private feed `https://nuget.bim.works/v3/index.json`. Your company portal has the credentials, or ask support@bimbase.nl.

Three things differ from nuget.org:

- **A project takes `BIM.works_SDK` from one of the two, never from both.** nuget.org signs its copy of every package, so the two files differ, and the hash in a `packages.lock.json` belongs to the source it was made with.
- **Map the package to the feed.** The SDK's dependency (`System.Text.Json`) still comes from nuget.org, so both sources are configured. The `packageSourceMapping` below makes `BIM.works_SDK` always come from the BIM.works feed; without it, NuGet takes it from whichever source answers first.
- **Switching sources means a new lock file.** Moving a project from nuget.org to the feed, or back, needs `dotnet restore --force-evaluate` once.

Put a `nuget.config` next to your solution:

```xml {#nuget-config}
<configuration>
  <packageSources>
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
    <add key="bimworks" value="https://nuget.bim.works/v3/index.json" />
  </packageSources>
  <packageSourceCredentials>
    <bimworks>
      <add key="Username" value="[your username]" />
      <add key="ClearTextPassword" value="[your password]" />
    </bimworks>
  </packageSourceCredentials>
  <packageSourceMapping>
    <packageSource key="bimworks"><package pattern="BIM.works_SDK" /></packageSource>
    <packageSource key="nuget.org"><package pattern="*" /></packageSource>
  </packageSourceMapping>
</configuration>
```

NuGet encrypts stored passwords on Windows only, hence `ClearTextPassword`; keep the file out of version control. On a build server, set the environment variable `NuGetPackageSourceCredentials_bimworks` to `Username=[your username];Password=[your password]` instead of the `packageSourceCredentials` block. Then add the package as in step 1.

### Check

With the classic SDK, create a factory, log in anonymously and print the server's version. This needs no API token.

```csharp {#check}
using System;
using BIM.works_SDK;

using (BimWorksClientFactory factory = new BimWorksClientFactory(new Uri(BIM_WORKS_ADDRESS)))
using (BimWorksClient client = factory.CreateAnonymousClient())
{
    Console.WriteLine(client.Info.GetApplicationVersion());
}
```

It prints a JSON object with the server's version. `CreateAnonymousClient` is on the factory ([[page:reference/dotnet]]) and `GetApplicationVersion` on [[dotnet:BIM.works_SDK.Info|Info]]. Next: [[page:how-to/auth/log-in-with-an-api-token]].
