Overview
This topic documents how to get started with the server-side .NET SDK, and links to reference information on all of the supported features.LaunchDarkly’s SDKs are open source. In addition to this reference guide, we provide source, API reference documentation, and a sample application:
Get started
The LaunchDarkly .NET SDK, version 8.9 and higher, is compatible with .NET 8.The LaunchDarkly .NET SDK, version 7.0 and higher, is compatible with .NET 6.0+, .NET Framework 4.6.2+, .NET Standard 2.0+, and .NET Core 3.1.Prior to version 7.0, the LaunchDarkly .NET SDK also supported .NET 5.0, .NET Framework 4.5.2 and .NET Framework 4.6.1, and .NET Core 2.1.
Install the SDK
First, install the LaunchDarkly SDK as a dependency in your application using your application’s dependency manager. We recommend making the LaunchDarkly observability plugin available as well. This plugin collects and sends observability data to LaunchDarkly. This means you can review error monitoring and logs from within the LaunchDarkly UI. It requires the .NET (server-side) SDK version 8.10 or later. Here’s how:The .NET (server-side) SDK uses an SDK key. Keys are specific to each project and environment. They are available from Project settings, on the Environments list. To learn more about key types, read Keys.
Initialize the client
After you install and import the SDK, create a single, shared instance ofLdClient. Specify your SDK key in the configuration to authorize your application to connect to a particular environment within LaunchDarkly.
To create a single instance:
ConfigurationBuilder.
Evaluate a context
You can useclient to check which variation a particular context will receive for a given feature flag. To learn more, read Evaluating flags and Flag evaluation reasons. For more information about how contexts are specified, read Context configuration.
In the v7 example, the context key is the string “example-context-key”. In the v6 example, the user key is the string “example-user-key”:
Kind method:
Transport Layer Security (TLS) and other networking issues
LaunchDarkly is deprecating support for TLS versions 1.0 and 1.- .NET applications running on older operating systems are prone to use these older, less secure versions of TLS. It is possible to increase your application’s security using AppContext switches.
Shut down the client
Shut down the client when your application terminates. To learn more, read Shutting down.Supported features
This SDK supports the following features:- Anonymous contexts and users
- Big segments
- Configuration, including
- Context configuration
- Data saving mode
- Evaluating flags
- Flag evaluation reasons
- Flushing events
- Getting all flags
- Hooks
- Identifying and changing contexts
- Logging configuration
- Migrations
- Monitoring SDK status
- Observability
- Offline mode
- OpenTelemetry
- Private attributes
- Reading flags from a file
- Relay Proxy configuration
- Secure mode
- Sending custom events
- Shutting down
- Storing data
- Subscribing to flag changes
- Test data sources
- Web proxy configuration