For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Sign inTry it free
DocsGuidesSDKsIntegrationsAPI docsTutorialsFlagship blog
DocsGuidesSDKsIntegrationsAPI docsTutorialsFlagship blog
  • SDKs
    • SDK concepts
    • SDK features
    • Client-side SDKs
      • .NET SDK reference
        • .NET (client-side) SDK 4.x to 5.0 migration guide
        • .NET (client-side) SDK 3.x to 4.0 migration guide
        • .NET (client-side) SDK 2.x to 3.0 migration guide
        • .NET (client-side) SDK 1.x to 2.0 migration guide
      • Android SDK reference
      • C++ SDK reference
      • Electron SDK reference
      • Flutter SDK reference
      • iOS SDK reference
      • JavaScript SDK reference
      • Node.js SDK reference
      • React SDK reference
      • Roku SDK reference
      • Vue SDK reference
    • Server-side SDKs
    • AI SDKs
    • Edge SDKs
    • OpenFeature providers
    • Observability SDKs
    • Relay Proxy
Sign inTry it free
LogoLogo
On this page
  • Overview
  • Understanding changes to SDK compatibility
  • Understanding changes to automatic environment attributes
SDKsClient-side SDKs.NET SDK reference

.NET (client-side) SDK 4.x to 5.0 migration guide

Was this page helpful?
Previous

.NET (client-side) SDK 3.x to 4.0 migration guide

Next
Built with

Overview

This topic explains the changes in the .NET (client-side) SDK 5.0 release and how to migrate to that version.

The .NET (client-side) SDK 5.0 release is currently in alpha.

Version 5.0 contains breaking changes. It introduces support for .NET 7 and MAUI, and drops support for Xamarin. As part of this change, the values of some environment attributes have changed. You may need to adjust your flag targeting rules as a result.

Understanding changes to SDK compatibility

You can continue to use the LaunchDarkly .NET (client-side) SDK version 5 in applications that can use Microsoft’s .NET Standard version 2.0 or higher, for example, console applications. You can also use it with MAUI, for example, for Android, Windows, and Mac applications.

If you use Xamarin, you cannot use version 5 of the LaunchDarkly .NET (client-side) SDK. You must migrate to MAUI to continue using the LaunchDarkly SDK. To learn more about migrating, read Microsoft’s documentation on how to Upgrade from Xamarin to .NET.

Understanding changes to automatic environment attributes

When you upgrade your .NET (client-side) SDK to version 5, you should review your flag targeting rules carefully. Some of the automatic environment attributes you may use in your targeting rules may have changed as part of the new SDK version.

If you enable automatic environment attributes during SDK initialization, LaunchDarkly automatically provides data about the environment where the application is running. This data makes it simpler to target your mobile customers based on application name or version, or on device characteristics including manufacturer, model, operating system, locale, and so on.

Here’s how:

.NET (client-side) SDK (C#)
1var config = Configuration
2 .Builder("example-mobile-key", ConfigurationBuilder.AutoEnvAttributes.Enabled)
3 .Build();

This data is provided in two context kinds, ld_application and ld_device. The SDK automatically adds this data to each evaluation context you provide. To learn more, read Automatic environment attributes.

When you upgrade from version 4 to version 5 of the LaunchDarkly .NET (client-side) SDK, the SDK returns different values for some of the attributes in the ld_application and ld_device contexts:

  • For Android, the ld_device attribute os/name now returns only the name. For example, the version 5 SDK returns Android, while the version 4 SDK returns Android28 or similar. Use the ld_device attribute os/version to access the version information.
  • For iOS, the ld_device attribute model now returns model numbers in some cases. For example, the version 5 SDK returns iPad5,2 or iPhone10,3, while the version 4 SDK returns iPad or iPhone.
  • For iOS, the ld_application attribute name is populated as follows:
    • ld_application.name returns the name that you set using application metadata configuration in the SDK, if any.
    • If that is not set, then the version 5 SDK returns the CFBundleDisplayName if defined. Otherwise, it returns the CFBundleName. This is a change in behavior. The version 4 SDK always returns the CFBundleName.
    • If that is not set, ld_application.name returns the LaunchDarkly SDK name and version.

These different context attribute values are because version 5 of the LaunchDarkly SDK uses .NET MAUI, while version 4 uses Xamarin Essentials.

To learn more about how the environment attributes are set, read About the automatically added environment attributes.