Skip to content

C#: .NET 11 buildless restore fails with empty targeting-pack directory while locked builds succeed #23133

Backlog

Description

@konard

While updating all dependency ecosystems in link-foundation/lino-objects-codec#87, we found a buildless restore limitation after moving to stable .NET SDK 11.0.100 / net11.0. This follows the basic .NET 11 support in #22565; that merged PR addresses installation, whereas this report concerns dependency resolution.

Affected observed setup: github/codeql-action 4.39.3, bundled CodeQL 2.27.4, Ubuntu 24.04, .NET SDK 11.0.100. The setup-dotnet step successfully installs and selects the current SDK. C# buildless extraction nevertheless replaces TargetFrameworkRootPath and NetCoreTargetingPackRoot with an empty directory and every project restore fails, before falling back to individual package guessing. The job itself reports success, so reading just the check result misses this.

Actual CI evidence: https://github.com/link-foundation/lino-objects-codec/actions/runs/43607982453/job/132486640838 (Analyze, 15:02:54–15:03:11 UTC). A reusable reproduction is in experiments/issue-86/codeql-restore.sh in the linked PR. From its repository checkout using SDK 11.0.100:

project=csharp/src/Lino.Objects.Codec/Lino.Objects.Codec.csproj
scratch=$(mktemp -d)
dotnet restore "$project" --no-dependencies \
  /p:DisableImplicitNuGetFallbackFolder=true \
  "/p:TargetFrameworkRootPath=$scratch" \
  "/p:NetCoreTargetingPackRoot=$scratch" \
  /p:AllowMissingPrunePackageData=true
# NU1102: Unable to find package System.Numerics.Vectors with version (>= 4.5.0)
# Found 27 version(s) in nuget.org [ Nearest version: 4.5.0 ]
dotnet restore "$project" --locked-mode
dotnet build "$project" --no-restore --configuration Release --no-incremental \
  -p:UseSharedCompilation=false
# Build succeeded. 0 warnings, 0 errors.
rm -rf "$scratch"

The library's one external PackageReference is Link.Foundation.Links.Notation 0.31.1, the current NuGet release. Keeping the real SDK targeting packs restores and builds the exact lock successfully. All 541 tests also pass with the actual graph. The comparison changes only the CodeQL-style restore properties; it does not relax requirements or replace packages.

Our local workaround is the documented manual build mode for C#, with explicit locked restores/builds of the solution, example and interop consumer. Other languages remain buildless. Proposed upstream improvement: use installed .NET 11 targeting packs (or an equivalent correctly pruned dependency restore) before falling back to package guessing, and test buildless extraction of a net11.0 project referencing a netstandard dependency. Report incomplete dependency resolution in the check diagnostics rather than relying on a successful fallback extraction. The buildless fallback also guesses nonexistent package IDs from XML fixture strings in Python tests; using evaluated project assets would avoid those false fetches.

Activity

  1. jketema commented on Nov 16, 2026

    @jketema
    Contributor

    Hi @konard,

    .NET 11 is currently not supported. We're working on support.

  2. michaelnebel commented on Nov 16, 2026

    @michaelnebel
    Contributor

    Hi @konard - Thank you very much for sharing!

    As @jketema mentions we don't officially claim support for .NET 11, but it should be possible to extract "something" (as you mention this is also indicated by the log).
    However, I am eager to learn about experienced discrepancies between .NET 10 and .NET 11.

    TargetFrameworkRootPath and NetCoreTargetingPackRoot with an empty directory

    This is how the dependency fetching heuristic was designed and not anything related to .NET 11.

    and every project fails

    This is not uncommon. The restore is a best effort attempt to restore as many dependencies as possible from the project files.
    The log indicates that 58 packages was restored in the process [2026-11-14 15:03:01] [build-stdout] [001] Restored 58 packages and that the fallback will attempt to restore 36 "missing" packages [2026-11-14 15:03:01] [build-stdout] [001] Found 36 packages that are not yet restored.

    • Did the project restore(s) succeed with .NET 10 for build-mode: none and/or how many packages did the log indicate was restored with .NET 10?
    • Do you experience a difference in the reported database quality when comparing between .NET 10 and .NET 11 build-mode: none extractions?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions