{"id":19149837,"url":"https://github.com/harness/ff-dotnet-client-sdk","last_synced_at":"2026-02-09T10:03:06.593Z","repository":{"id":237754601,"uuid":"790751102","full_name":"harness/ff-dotnet-client-sdk","owner":"harness","description":".NET client SDK for Feature Flags","archived":false,"fork":false,"pushed_at":"2025-01-21T10:31:56.000Z","size":885,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-04-14T17:21:32.734Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/harness.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-04-23T13:12:17.000Z","updated_at":"2024-05-08T11:21:30.000Z","dependencies_parsed_at":null,"dependency_job_id":"70311dcd-c73b-4ae6-906b-41d324ac7bf0","html_url":"https://github.com/harness/ff-dotnet-client-sdk","commit_stats":null,"previous_names":["harness/ff-dotnet-client-sdk"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/harness/ff-dotnet-client-sdk","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harness%2Fff-dotnet-client-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harness%2Fff-dotnet-client-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harness%2Fff-dotnet-client-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harness%2Fff-dotnet-client-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/harness","download_url":"https://codeload.github.com/harness/ff-dotnet-client-sdk/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harness%2Fff-dotnet-client-sdk/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29261651,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-09T04:11:57.159Z","status":"ssl_error","status_checked_at":"2026-02-09T04:11:56.117Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T08:09:47.818Z","updated_at":"2026-02-09T10:03:06.575Z","avatar_url":"https://github.com/harness.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":".NET client SDK for Feature Flags\n========================\n\n## Intro\n\nUse this README to get started with our Feature Flags (FF) SDK for .NET.\nThis guide outlines the basics of getting started with the SDK and\nprovides a full code sample for you to try out.\n\n## Which SDK to use\n\nThis is a client SDK. For .NET Harness provides both client and server\nSDKs. You should choose the correct one for your needs. A client SDK\nshould typically be used in environments where network bandwidth and\nprocessing power are limited like desktop apps or MAUI apps. A client API key provides restricted access\nto flag state for one target only. Whereas a server SDK will download rule\ninformation and process evaluations locally for many targets. A server\nSDK API key should only be used in secure environments. See\n[.NET Server SDK](https://github.com/harness/ff-dotnet-server-sdk)\n\n\n## Requirements\nThe library is packaged as multi-target supporting  `net461`,`netstandard2.0`,\n`net5.0`, `net6.0`, `net7.0` and `net8.0`.\n\n## Build Requirements\nIf building from source you will need [.Net 7.0.404](https://dotnet.microsoft.com/en-us/download/dotnet/7.0) or newer (`dotnet --version`)\u003cbr\u003e\n\n## Quickstart\nTo follow along with our test code sample, make sure you’ve:\n\n- [Created a Feature Flag on the Harness Platform](https://ngdocs.harness.io/article/1j7pdkqh7j-create-a-feature-flag) called `harnessappdemodarkmode`\n- [Created a client SDK key and made a copy of it](https://developer.harness.io/docs/feature-flags/get-started/java-quickstart#create-an-sdk-key)\n\n### Install the SDK\nAdd the sdk using dotnet\n```bash\ndotnet add package ff-dotnet-client-sdk\n```\n\n## Examples\n\n### Getting started\nSee [Getting Started example](examples/getting_started)\n\nThis is a generic .NET application that targets `.net8.0`. It will create an SDK instance with a target (plus some attributes) and loop for several\niterations and exit. While it is running changing the flag  `harnessappdemodarkmode` via the UI will show the state in the console output.\n\n### MAUI\nSee [MAUI example app](examples/mauiapp_basic_example/README.md).\n\nThis is an example that shows you the client SDK working inside a [MAUI](https://dotnet.microsoft.com/en-us/apps/maui) app. MAUI allows you to deploy and target\nmultiple platforms (such as Android, iOS, macOS) while keeping a single portable C# codebase.\n\n![MAUI example app](readme/maui_preview.png \"MAUI\")\n\n### Code Sample\nThe 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:\n- Connect to the FF service.\n- Report the value of the Flag every second until the connection is closed. Every time the `harnessappdemodarkmode` Flag is toggled on or off on the Harness Platform, the updated value is reported.\n- Close the SDK with the `using` statement.\n\n\n```\nusing io.harness.ff_dotnet_client_sdk.client;\nusing io.harness.ff_dotnet_client_sdk.client.dto;\nusing Serilog;\nusing Serilog.Extensions.Logging;\n\nnamespace getting_started;\nusing System;\n\npublic static class Program\n{\n\n    public static void Main(string[] args)\n    {\n        var apiKey = Environment.GetEnvironmentVariable(\"FF_API_KEY\");\n        var flagName = Environment.GetEnvironmentVariable(\"FF_FLAG_NAME\") ?? \"harnessappdemodarkmode\";\n\n        if (string.IsNullOrEmpty(apiKey) || string.IsNullOrEmpty(flagName)) throw new Exception(\"Please set FF_API_KEY and FF_FLAG_NAME\");\n\n        var loggerFactory = new SerilogLoggerFactory(\n            new LoggerConfiguration()\n                .MinimumLevel.Verbose()\n                .WriteTo.Console()\n                .CreateLogger());\n\n        var config = FfConfig.Builder().LoggerFactory(loggerFactory).Debug(true).Build();\n\n        /*\n         * Define your target (and attributes for any server side rules you may have)\n         */\n        FfTarget target = new FfTarget(\"dotnetclientsdk\", \".NET Client SDK\",\n            new Dictionary\u003cstring, string\u003e { { \"email\", \"person@myorg.com\" }});\n\n        /*\n         * Set up the SDK.\n         * It implements `IDisposable`, 'using' will free it when it goes out of scope\n         */\n        using var client = new FfClient();\n        client.Initialize(apiKey, config, target);\n\n        if (!client.WaitForInitialization(60_000))\n            throw new Exception(\"Timed out waiting for SDK to initialize\");\n\n\n        /*\n         * Iterate a few times\n         */\n\n        for (var i = 1; i \u003c 100; i++)\n        {\n            var value = client.BoolVariation(flagName, false);\n            \n            Console.Out.WriteLine(\"flag {0} = {1}\", flagName, value);\n            Thread.Sleep(TimeSpan.FromSeconds(1));\n        }\n\n    }\n}\n```\n\n### Running the example\n\n```bash\nexport FF_API_KEY=\u003cyour key here\u003e\ndotnet run --project examples/getting_started/\n```\n\n### Running the example with Docker\nIf you don't have the right version of dotnet installed locally, or don't want to install the dependencies you can\nuse docker to quicky get started\n\n```bash\ndocker 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/\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharness%2Fff-dotnet-client-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fharness%2Fff-dotnet-client-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharness%2Fff-dotnet-client-sdk/lists"}