{"id":19149829,"url":"https://github.com/harness/ff-dotnet-server-sdk","last_synced_at":"2025-05-07T04:44:50.509Z","repository":{"id":37961478,"uuid":"373889085","full_name":"harness/ff-dotnet-server-sdk","owner":"harness","description":".net Server SDK for integrating with Harness Feature Flag service.","archived":false,"fork":false,"pushed_at":"2024-09-23T17:12:11.000Z","size":438,"stargazers_count":5,"open_issues_count":1,"forks_count":10,"subscribers_count":22,"default_branch":"main","last_synced_at":"2025-05-07T04:44:43.066Z","etag":null,"topics":["cd","ci","dotnet","feature-flags","sdk"],"latest_commit_sha":null,"homepage":"https://harness.io/","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":"2021-06-04T15:42:59.000Z","updated_at":"2024-09-23T15:45:35.000Z","dependencies_parsed_at":"2024-01-10T09:31:45.618Z","dependency_job_id":"14e97d73-ec09-4cd0-b0a8-654d7d7ffc0f","html_url":"https://github.com/harness/ff-dotnet-server-sdk","commit_stats":null,"previous_names":["drone/ff-dotnet-server-sdk"],"tags_count":43,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harness%2Fff-dotnet-server-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harness%2Fff-dotnet-server-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harness%2Fff-dotnet-server-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harness%2Fff-dotnet-server-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/harness","download_url":"https://codeload.github.com/harness/ff-dotnet-server-sdk/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252816520,"owners_count":21808702,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["cd","ci","dotnet","feature-flags","sdk"],"created_at":"2024-11-09T08:09:46.252Z","updated_at":"2025-05-07T04:44:50.488Z","avatar_url":"https://github.com/harness.png","language":"C#","readme":".NET SDK For Harness Feature Flags\n========================\n\n## Table of Contents\n**[Intro](#Intro)**\u003cbr\u003e\n**[Requirements](#Requirements)**\u003cbr\u003e\n**[Quickstart](#Quickstart)**\u003cbr\u003e\n**[Further Reading](docs/further_reading.md)**\u003cbr\u003e\n**[Build Instructions](docs/build.md)**\u003cbr\u003e\n\n\n## Intro\nUse 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.\nThis 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](https://ngdocs.harness.io/article/c86rasy39v-net-sdk-reference).\n\nFor a sample FF .NET SDK project, see our [test .NET project](examples/getting_started/).\n\n![FeatureFlags](https://github.com/harness/ff-python-server-sdk/raw/main/docs/images/ff-gui.png)\n\n## Requirements\nThe library is packaged as multi-target supporting  `net461`,`netstandard2.0`, `net5.0`, `net6.0` and `net7.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 server SDK key and made a copy of it](https://ngdocs.harness.io/article/1j7pdkqh7j-create-a-feature-flag#step_3_create_an_sdk_key)\n\n\n\n### Install the SDK\nAdd the sdk using dotnet\n```bash\ndotnet add package ff-dotnet-server-sdk\n```\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 10 seconds 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.\n\n\n```c#\nusing System;\nusing System.Collections.Generic;\nusing io.harness.cfsdk.client.dto;\nusing io.harness.cfsdk.client.api;\nusing System.Threading;\n\nnamespace getting_started\n{\n    class Program\n    {\n        public static String apiKey = Environment.GetEnvironmentVariable(\"FF_API_KEY\");\n        public static String flagName = Environment.GetEnvironmentVariable(\"FF_FLAG_NAME\") is string v \u0026\u0026 v.Length \u003e 0 ? v : \"harnessappdemodarkmode\";\n\n        static void Main(string[] args)\n        {\n            // Configure your logger\n            var loggerFactory = new SerilogLoggerFactory(\n                new LoggerConfiguration()\n                    .MinimumLevel.Information()\n                    .WriteTo.Console()\n                    .CreateLogger());\n\n            // Create a feature flag client\n            CfClient.Instance.Initialize(apiKey, Config.Builder().LoggerFactory(loggerFactory).Build());\n            var isInit = CfClient.Instance.WaitForInitialization(30000);\n            if (!isInit)\n            {\n                Console.WriteLine(\"Failed to init the SDK within 30seconds\");\n            }\n\n            // Create a target (different targets can get different results based on rules)\n            Target target = Target.builder()\n                            .Name(\"Harness_Target_1\")\n                            .Identifier(\"HT_1\")\n                            .Attributes(new Dictionary\u003cstring, string\u003e(){{\"email\", \"demo@harness.io\"}})\n                            .build();\n\n           // Loop forever reporting the state of the flag\n            while (true)\n            {\n                bool resultBool = CfClient.Instance.boolVariation(flagName, target, false);\n                Console.WriteLine(\"Flag variation \" + resultBool);\n                Thread.Sleep(10 * 1000);\n            }\n        }\n    }\n}\n\n```\n\n### Running the example\n\n```bash\n$ export FF_API_KEY=\u003cyour key here\u003e\n$ dotnet run --project examples/getting_started/\n```\n\n### Running the example with Docker\nIf you dont have the right version of dotnet installed locally, or dont want to install the dependancies 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:6.0 dotnet run --framework net6.0 --project examples/getting_started/\n```\n\n### Additional Reading\n\n\nFor further examples and config options, see the [.NET SDK Reference](https://ngdocs.harness.io/article/c86rasy39v-net-sdk-reference#).\n\nFor more information about Feature Flags, see our [Feature Flags documentation](https://ngdocs.harness.io/article/0a2u2ppp8s-getting-started-with-feature-flags).\n\n\n-------------------------\n[Harness](https://www.harness.io/) is a feature management platform that helps teams to build better software and to\ntest features quicker.\n\n-------------------------\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharness%2Fff-dotnet-server-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fharness%2Fff-dotnet-server-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharness%2Fff-dotnet-server-sdk/lists"}