Skip to content

Difficulty maintaining compatibility with installed .NET versions due to NuGet package versioning #114359

Open
@michmela44

Description

@michmela44

I'm encountering issues while trying to ship a .NET 8 application without bundling additional platform binaries—relying entirely on the presence of the system-installed .NET runtime.

However, due to NuGet package versioning, I’m forced to include assemblies that require newer runtime components than what may be present—even when targeting .NET 8 LTS.

We are preparing to release an application that has been migrated from .NET Framework 4.8 to .NET 8.0, and we are unsure how distribution should be handled given these scenarios.


Example 1: System.Formats.Nrbf

  • Target framework: .NET 8
  • We use System.Formats.Nrbf for .NET Framework 4.8 migration compatibility.
  • Package version is 9.0.3, which depends on:
    • System.Reflection.Metadata ≥ 9.0.3
    • which in turn depends on System.Collections.Immutable ≥ 9.0.3

This results in the app requiring framework components that may not exist on a machine with only the base .NET 8.0.10 install, unless those assemblies are explicitly bundled.


Example 2: Microsoft.Extensions.Logging

  • In a plain .NET 8 app (non-ASP.NET), referencing Microsoft.Extensions.Logging leads to similar issues, including dependencies like System.Diagnostics.DiagnosticSource.
  • Even patch-level mismatches (e.g., built on 8.0.13, deployed on 8.0.10) have caused runtime failures unless assemblies are manually shipped.

Attempts to Work Around:

  • I’ve tried stripping DLLs from the output to allow the runtime to resolve them from the shared framework. However, patch-level mismatches often cause the app to fail to start.
  • Maintaining an ever-growing list of DLLs to exclude from the installer has proven fragile and difficult.

Key Questions:

  1. Is there a supported way to use .NET 8 NuGet packages without bundling newer framework binaries?
  2. Are patch versions (e.g., 8.0.10 vs. 8.0.13) guaranteed to be runtime-compatible?
  3. What is Microsoft’s intended guidance for compatibility when consuming packages like System.Formats.Nrbf or Microsoft.Extensions.Logging?
  4. Should developers avoid packages outside the shared framework if they want to avoid shipping DLLs?
  5. Or is it expected that if you use anything beyond the base shared framework, a self-contained or framework-dependent deployment (with copied DLLs) is required?

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-Infrastructure-librariesneeds-further-triageIssue has been initially triaged, but needs deeper consideration or reconsiderationquestionAnswer questions and provide assistance, not an issue with source code or documentation.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions