### Run ASP.NET Core Application Source: https://github.com/configcat/.net-sdk/blob/master/samples/ASP.NETCore/README.md Execute this command to start the ASP.NET Core MVC application. Ensure .NET is installed. ```bash dotnet run ``` -------------------------------- ### Install ConfigCat SDK using NuGet Package Manager Source: https://github.com/configcat/.net-sdk/blob/master/README.md Use this command to install the ConfigCat client package via the NuGet Package Manager Console. ```powershell Install-Package ConfigCat.Client ``` -------------------------------- ### Install ConfigCat SDK using .NET CLI Source: https://github.com/configcat/.net-sdk/blob/master/README.md Use this command to add the ConfigCat client package to your project using the .NET CLI. ```bash dotnet add package ConfigCat.Client ``` -------------------------------- ### Run Blazor App Source: https://github.com/configcat/.net-sdk/blob/master/samples/BlazorWasm/README.md Execute this command to run the Blazor WebAssembly application. Ensure .NET is installed. ```bash dotnet run -- urls=http://localhost:5000 ``` -------------------------------- ### Serve Blazor App with Local Server Source: https://github.com/configcat/.net-sdk/blob/master/samples/BlazorWasm/README.md Start a local web server in the publish output directory to serve the Blazor WebAssembly application files over HTTP. This is typically done after building for AOT compilation. ```bash dotnet serve --port 5000 ``` -------------------------------- ### Install .NET WebAssembly Build Tools Source: https://github.com/configcat/.net-sdk/blob/master/samples/BlazorWasm/README.md Install the necessary .NET WebAssembly build tools for AOT compilation. This is a prerequisite for building Blazor Wasm applications with AOT. ```bash dotnet workload install wasm-tools ``` -------------------------------- ### Get Setting Value and Evaluate Feature Flag Source: https://github.com/configcat/.net-sdk/blob/master/README.md Retrieve the value of a setting asynchronously and use it to control application flow. Provide a default value for cases where the setting cannot be fetched. ```csharp var isMyAwesomeFeatureEnabled = await client.GetValueAsync("isMyAwesomeFeatureEnabled", false); if (isMyAwesomeFeatureEnabled) { doTheNewThing(); } else { doTheOldThing(); } ``` -------------------------------- ### Get User-Specific Setting Value with Targeting Source: https://github.com/configcat/.net-sdk/blob/master/README.md Retrieve a setting value based on the provided user object, enabling targeted feature flag evaluation. Ensure you have defined targeting rules in the ConfigCat dashboard. ```csharp var currentUser = new User("#USER-IDENTIFIER#"); var isMyAwesomeFeatureEnabled = await client.GetValueAsync( "isMyAwesomeFeatureEnabled", defaultValue: false, user: currentUser); ``` -------------------------------- ### Navigate to WebApplication Directory Source: https://github.com/configcat/.net-sdk/blob/master/samples/ASP.NETCore/README.md Change your current directory to the WebApplication folder to proceed with running the sample. ```bash cd WebApplication ``` -------------------------------- ### Build Project from Command Line Source: https://github.com/configcat/.net-sdk/blob/master/CONTRIBUTING.md Use this command to build the ConfigCatClient project from the command line. ```bash dotnet build src/ConfigCatClient.sln ``` -------------------------------- ### Create ConfigCat Client Instance Source: https://github.com/configcat/.net-sdk/blob/master/README.md Instantiate the ConfigCat client using your SDK Key. Subsequent calls with the same SDK key return a shared client instance. ```csharp var client = ConfigCatClient.Get("#YOUR-SDK-KEY#"); ``` -------------------------------- ### Build Sample App with Native AOT (Windows) Source: https://github.com/configcat/.net-sdk/blob/master/samples/ConsoleApp/README.md Use this script to build the sample application for Native AOT compilation on Windows. Locate the executable in the publish output directory. ```cmd build-aot.cmd ``` -------------------------------- ### Build Sample App with Native AOT (Linux) Source: https://github.com/configcat/.net-sdk/blob/master/samples/ConsoleApp/README.md Use this script to build the sample application for Native AOT compilation on Linux. Locate the executable in the publish output directory. ```bash build-aot.sh ``` -------------------------------- ### Include Raw Assets in MAUI Project Source: https://github.com/configcat/.net-sdk/blob/master/samples/MAUI/Resources/Raw/AboutAssets.txt Add this `MauiAsset` build action to your `.csproj` file to include all files in the `Resources\Raw` directory and its subdirectories as deployable assets. ```xml ``` -------------------------------- ### Import ConfigCat Client Namespace Source: https://github.com/configcat/.net-sdk/blob/master/README.md Add this using statement to your C# code to access the ConfigCat client functionalities. ```csharp using ConfigCat.Client; ``` -------------------------------- ### Run .NET SDK Tests Source: https://github.com/configcat/.net-sdk/blob/master/DEPLOY.md Execute all unit tests for the ConfigCat .NET SDK before deployment. Ensure all tests pass to maintain code quality. ```PowerShell dotnet test src/ConfigCatClient.sln ``` -------------------------------- ### Push Git Tag for Deployment Source: https://github.com/configcat/.net-sdk/blob/master/DEPLOY.md Create a new version tag and push it to the remote repository to trigger the automated deployment pipeline. This action publishes the package to NPM. ```Git git push origin ``` ```Git git push origin v1.1.15 ``` -------------------------------- ### Access Raw Assets in MAUI Application Source: https://github.com/configcat/.net-sdk/blob/master/samples/MAUI/Resources/Raw/AboutAssets.txt Use `FileSystem.OpenAppPackageFileAsync` to open a stream to a raw asset deployed with your application. This method is part of the Essentials API. ```csharp async Task LoadMauiAsset() { using var stream = await FileSystem.OpenAppPackageFileAsync("AboutAssets.txt"); using var reader = new StreamReader(stream); var contents = reader.ReadToEnd(); } ``` -------------------------------- ### Dispose ConfigCat Client Source: https://github.com/configcat/.net-sdk/blob/master/README.md Call the Dispose method on the client instance when your application exits to ensure graceful shutdown and release resources. ```csharp client.Dispose(); ``` -------------------------------- ### Dispose All ConfigCat Clients Source: https://github.com/configcat/.net-sdk/blob/master/README.md Use this static method to close all currently open ConfigCat client instances. ```csharp ConfigCatClient.DisposeAll(); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.