ff-dotnet-server-sdk-async
1.8.2
dotnet add package ff-dotnet-server-sdk-async --version 1.8.2
NuGet\Install-Package ff-dotnet-server-sdk-async -Version 1.8.2
<PackageReference Include="ff-dotnet-server-sdk-async" Version="1.8.2" />
<PackageVersion Include="ff-dotnet-server-sdk-async" Version="1.8.2" />
<PackageReference Include="ff-dotnet-server-sdk-async" />
paket add ff-dotnet-server-sdk-async --version 1.8.2
#r "nuget: ff-dotnet-server-sdk-async, 1.8.2"
#:package ff-dotnet-server-sdk-async@1.8.2
#addin nuget:?package=ff-dotnet-server-sdk-async&version=1.8.2
#tool nuget:?package=ff-dotnet-server-sdk-async&version=1.8.2
.NET SDK For Harness Feature Flags
Table of Contents
Intro Requirements Quickstart Further Reading Build Instructions
Intro
Use this README to get started with our Feature Flags (FF) SDK for .NET. This guide outlines the basics of getting started with the SDK and provides a full code sample for you to try out. This sample doesn’t include configuration options, for in depth steps and configuring the SDK, for example, disabling streaming or using our Relay Proxy, see the .NET SDK Reference.
For a sample FF .NET SDK project, see our test .NET project.
Requirements
The library is packaged as multi-target supporting net461,netstandard2.0, net5.0, net6.0, net7.0, and net8.0.
Build Requirements
If building from source you will need .Net 8.0.0 or newer (dotnet --version)<br>
Quickstart
To follow along with our test code sample, make sure you’ve:
- Created a Feature Flag on the Harness Platform called harnessappdemodarkmode
- Created a server SDK key and made a copy of it
Install the SDK
Add the sdk using dotnet
dotnet add package ff-dotnet-server-sdk
Code Sample
The following is a complete code example that you can use to test the harnessappdemodarkmode Flag you created on the Harness Platform. When you run the code it will:
- Connect to the FF service.
- Report the value of the Flag every 10 seconds until the connection is closed. Every time the
harnessappdemodarkmodeFlag is toggled on or off on the Harness Platform, the updated value is reported. - Close the SDK.
using System;
using System.Collections.Generic;
using io.harness.cfsdk.client.dto;
using io.harness.cfsdk.client.api;
using System.Threading;
namespace getting_started
{
class Program
{
public static String apiKey = Environment.GetEnvironmentVariable("FF_API_KEY");
public static String flagName = Environment.GetEnvironmentVariable("FF_FLAG_NAME") is string v && v.Length > 0 ? v : "harnessappdemodarkmode";
static void Main(string[] args)
{
// Configure your logger
var loggerFactory = new SerilogLoggerFactory(
new LoggerConfiguration()
.MinimumLevel.Information()
.WriteTo.Console()
.CreateLogger());
// Create a feature flag client
CfClient.Instance.Initialize(apiKey, Config.Builder().LoggerFactory(loggerFactory).Build());
var isInit = CfClient.Instance.WaitForInitialization(30000);
if (!isInit)
{
Console.WriteLine("Failed to init the SDK within 30seconds");
}
// Create a target (different targets can get different results based on rules)
Target target = Target.builder()
.Name("Harness_Target_1")
.Identifier("HT_1")
.Attributes(new Dictionary<string, string>(){{"email", "demo@harness.io"}})
.build();
// Loop forever reporting the state of the flag
while (true)
{
bool resultBool = CfClient.Instance.boolVariation(flagName, target, false);
Console.WriteLine("Flag variation " + resultBool);
Thread.Sleep(10 * 1000);
}
}
}
}
Running the example
$ export FF_API_KEY=<your key here>
$ dotnet run --project examples/getting_started/
Running the example with Docker
If you don't have the right version of dotnet installed locally, or don't want to install the dependencies you can use docker to quickly get started
docker run -v $(pwd):/app -w /app -e FF_API_KEY=$FF_API_KEY mcr.microsoft.com/dotnet/sdk:8.0 dotnet run --framework net8.0 --project examples/getting_started/
Additional Reading
For further examples and config options, see the .NET SDK Reference.
For more information about Feature Flags, see our Feature Flags documentation.
Harness is a feature management platform that helps teams to build better software and to test features quicker.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 is compatible. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 is compatible. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 is compatible. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.6.1
- Microsoft.Extensions.Logging.Abstractions (>= 6.0.0)
- Microsoft.Extensions.Logging.Console (>= 6.0.0)
- murmurhash (>= 1.0.3)
- Newtonsoft.Json (>= 13.0.3)
- System.ComponentModel.Annotations (>= 5.0.0)
- System.IdentityModel.Tokens.Jwt (>= 6.36.0)
- System.Net.Http (>= 4.3.4)
-
.NETFramework 4.8
- Microsoft.Extensions.Logging.Abstractions (>= 6.0.0)
- Microsoft.Extensions.Logging.Console (>= 6.0.0)
- murmurhash (>= 1.0.3)
- Newtonsoft.Json (>= 13.0.3)
- System.ComponentModel.Annotations (>= 5.0.0)
- System.IdentityModel.Tokens.Jwt (>= 6.36.0)
- System.Net.Http (>= 4.3.4)
-
.NETStandard 2.0
- Microsoft.Extensions.Logging.Abstractions (>= 6.0.0)
- Microsoft.Extensions.Logging.Console (>= 6.0.0)
- murmurhash (>= 1.0.3)
- Newtonsoft.Json (>= 13.0.3)
- System.ComponentModel.Annotations (>= 5.0.0)
- System.IdentityModel.Tokens.Jwt (>= 6.36.0)
- System.Net.Http (>= 4.3.4)
-
net5.0
- Microsoft.Extensions.Logging.Abstractions (>= 6.0.0)
- Microsoft.Extensions.Logging.Console (>= 6.0.0)
- murmurhash (>= 1.0.3)
- Newtonsoft.Json (>= 13.0.3)
- System.ComponentModel.Annotations (>= 5.0.0)
- System.IdentityModel.Tokens.Jwt (>= 6.36.0)
-
net6.0
- Microsoft.Extensions.Logging.Abstractions (>= 6.0.0)
- Microsoft.Extensions.Logging.Console (>= 6.0.0)
- murmurhash (>= 1.0.3)
- Newtonsoft.Json (>= 13.0.3)
- System.ComponentModel.Annotations (>= 5.0.0)
- System.IdentityModel.Tokens.Jwt (>= 6.36.0)
-
net7.0
- Microsoft.Extensions.Logging.Abstractions (>= 6.0.0)
- Microsoft.Extensions.Logging.Console (>= 6.0.0)
- murmurhash (>= 1.0.3)
- Newtonsoft.Json (>= 13.0.3)
- System.ComponentModel.Annotations (>= 5.0.0)
- System.IdentityModel.Tokens.Jwt (>= 7.7.1)
-
net8.0
- Microsoft.Extensions.Logging.Abstractions (>= 6.0.0)
- Microsoft.Extensions.Logging.Console (>= 6.0.0)
- murmurhash (>= 1.0.3)
- Newtonsoft.Json (>= 13.0.3)
- System.ComponentModel.Annotations (>= 5.0.0)
- System.IdentityModel.Tokens.Jwt (>= 8.0.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.8.2 | 320 | 8/6/2026 |
| 1.8.2-preview-1 | 112 | 8/6/2026 |
| 1.8.1 | 343 | 6/16/2026 |
| 1.8.0 | 123 | 6/16/2026 |
.NET Server SDK for Harness Feature Flag platform