-
Notifications
You must be signed in to change notification settings - Fork 1.9k
C#: Support .slnx. solution files.
#21016
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds support for .slnx (XML-based solution) files in the C# CodeQL analysis for both build-mode: none and autobuilder scenarios. The implementation leverages the Microsoft.VisualStudio.SolutionPersistence NuGet package to parse .slnx files using the existing SolutionFile.Parse() API.
Key changes:
- Added
.slnxto supported file extensions in documentation - Created integration tests for both standalone and autobuilder scenarios with
.slnxfiles - Updated dependency files to include
Microsoft.VisualStudio.SolutionPersistencepackage
Reviewed changes
Copilot reviewed 31 out of 33 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| docs/codeql/reusables/supported-versions-compilers.rst | Added .slnx to the list of supported file extensions for C# |
| csharp/ql/lib/change-notes/2025-12-11-slnx-support.md | Added change note documenting the new feature |
| csharp/ql/integration-tests/posix/standalone_dependencies_executing_runtime/Assemblies.expected | Updated expected assemblies to include the new SolutionPersistence DLL |
| csharp/ql/integration-tests/all-platforms/standalone_slnx/* | New integration test suite for standalone extraction with .slnx files |
| csharp/ql/integration-tests/all-platforms/autobuild_slnx/* | New integration test suite for autobuilder with .slnx files |
| csharp/paket.main.bzl | Updated package versions and added Microsoft.VisualStudio.SolutionPersistence dependency |
| csharp/paket.lock | Updated lock file with new package versions |
| csharp/paket.dependencies | Added Microsoft.VisualStudio.SolutionPersistence package reference |
| csharp/extractor/Semmle.Util/Language.cs | Enhanced Language class to support solution-specific extensions; refactored constructors with parameter reordering |
| csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/paket.references | Added SolutionPersistence package reference |
| csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/SolutionFile.cs | Updated comments to mention .slnx support |
| csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/FileProvider.cs | Extended solution file search to include .slnx extension |
| csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/BUILD.bazel | Added SolutionPersistence dependency |
| csharp/autobuilder/Semmle.Autobuild.Shared/paket.references | Added SolutionPersistence package reference |
| csharp/autobuilder/Semmle.Autobuild.Shared/Solution.cs | Updated comments to mention .slnx support |
| csharp/autobuilder/Semmle.Autobuild.Shared/BUILD.bazel | Added SolutionPersistence dependency |
| csharp/autobuilder/Semmle.Autobuild.Shared/Autobuilder.cs | Added logic to search for language-specific solution files (.slnx) in build priority |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| private Language(string name, string projectExtension) | ||
| { | ||
| ProjectExtension = extension; | ||
| ProjectExtension = projectExtension; | ||
| UpperCaseName = name; | ||
| } |
Copilot
AI
Dec 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The parameter order has been changed in the constructor, which could be a breaking change if this constructor is called from other places in the codebase. However, this appears to be intentional to make the API more readable with the name parameter first. Note that both constructors have their parameters swapped from (extension, name) to (name, extension).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The constructors are private.
|
DCA looks good. |
In this PR we implement support for the
.slnxfile format - both forbuild-mode: noneand autobuilder.Even though it is discouraged to use
SolutionFile.Parse(it is considered an internal implementation detail), it appears that parsing support for.slnxwas introduced here. If we wan't to do it the supported way, we would basically need to copy the parsing implementation. IMO we should continue to use the exposed parsing functionality and only mirror the implementation in case it becomes deprecated.We need to explicitly reference
Microsoft.VisualStudio.SolutionPersistencefor the new parsing to be applied.This feature is now more crucial as .NET 10 uses the
.slnxformat as default, which is explained here