Skip to content

Remove Newtonsoft.Json from the .NET SDK installation #53287

@MichaelSimons

Description

@MichaelSimons

Summary

The .NET SDK currently ships the Newtonsoft.Json assembly in several locations within the SDK layout. We should remove this dependency from the SDK by eliminating project references that bring it in and migrating usages to System.Text.Json where possible.

Removing this dependency would reduce the SDK servicing surface area, decrease SDK size, and unblock work related to Native AOT.

Motivation

Security / Servicing

Bundling Newtonsoft.Json in the SDK introduces an additional dependency that must be monitored and serviced for potential security vulnerabilities.

Migrating to System.Text.Json reduces this servicing burden because it ships as part of the .NET platform and is already covered by the platform servicing model.

SDK Size Reduction

Removing Newtonsoft.Json would also help reduce the size of the SDK installation.

Historically the SDK contained multiple copies of this assembly. Deduplication work reduced this to two primary copies, but it still contributes unnecessary size to the SDK.

Related work:

Native AOT Compatibility

Usage of Newtonsoft.Json is a blocker for some Native AOT scenarios due to its heavy reliance on reflection and dynamic behavior. Migrating to System.Text.Json helps unblock this work.

Related work:

Current Locations in the SDK

The following instances of Newtonsoft.Json.dll currently appear in the SDK layout:

Migration Guideline

https://learn.microsoft.com/en-us/dotnet/standard/serialization/system-text-json/migrate-from-newtonsoft?pivots=dotnet-10-0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions