C#: Fix NuGet version bug and a .NET10 compatibility issue.#20964
Merged
michaelnebel merged 5 commits intogithub:mainfrom Dec 8, 2025
Merged
C#: Fix NuGet version bug and a .NET10 compatibility issue.#20964michaelnebel merged 5 commits intogithub:mainfrom
michaelnebel merged 5 commits intogithub:mainfrom
Conversation
…g non-existing framework targets.
… sorting for finding newest package version.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes two critical issues in the dependency fetcher used by build mode none (BMN) to improve .NET framework version handling and ensure .NET 10 compatibility.
- Replaces custom version sorting logic with NuGet's
NuGetVersionclass for proper semantic versioning - Adds
/p:AllowMissingPrunePackageData=trueflag to handle .NET 10 breaking changes in restore operations - Refactors
DotNetVersionclass to useNuGetVersioninternally, eliminating custom version comparison code
Reviewed changes
Copilot reviewed 12 out of 13 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| csharp/ql/lib/change-notes/2025-12-04-bmn-dotnet-fixes.md | Documents the bug fixes for version sorting and .NET 10 compatibility |
| csharp/ql/integration-tests/posix/standalone_dependencies_executing_runtime/Assemblies.expected | Updates test expectations to include the new NuGet.Versioning.dll dependency |
| csharp/paket.main.bzl | Adds NuGet.Versioning 7.0.1 package configuration to the build system |
| csharp/paket.lock | Locks NuGet.Versioning 7.0.1 as a project dependency |
| csharp/paket.dependencies | Declares NuGet.Versioning as a required package |
| csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/paket.references | References NuGet.Versioning for the DependencyFetching project |
| csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/Sdk.cs | Updates regex and parsing to use NuGetVersion for SDK version detection |
| csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/Runtime.cs | Updates regex and parsing to use NuGetVersion for runtime version detection |
| csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/NugetPackageRestorer.cs | Implements semantic version sorting for NuGet package directories using NuGetVersion |
| csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/DotNetVersion.cs | Simplifies implementation to delegate version comparison to NuGetVersion |
| csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/DotNet.cs | Adds AllowMissingPrunePackageData flag for .NET 10 compatibility in restore operations |
| csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/DependencyManager.cs | Updates method call to match signature change from static to instance method |
| csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/BUILD.bazel | Adds nuget.versioning build dependency |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
Author
|
DCA looks good
So overall this is an improvement for BMN. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR enhances the dependency fetcher utilized by BMN.
/p:AllowMissingPrunePackageData=trueto thedotnet restorearguments. This addresses a breaking change between .NET 9 and .NET 10, where restoring fails if we intentionally use fake framework directories to trigger framework downloads (these restores are intended as best-effort attempts).9to10.DotNetVersionclass to useNuGetVersioninternally, replacing the custom logic previously in use.