NDepend Blog

Improve your .NET code quality with NDepend

.slnx The New .NET Solution XML File Format

March 17, 2025 3 minutes read

slnx Solution File Format

On March 13th, 2025 Microsoft officially announced the a new .NET solution file format with file extension .slnx.

For example for this simple solution:

Sample-Visual-Studio-Solution

The content of the .slnx file is:

Why a new Solution File Format?

For decades the .sln solution file format relied on a Microsoft proprietary file format, verbose, hardly readable, and based on GUIDs. At NDepend, given our focus on .NET tools, we’ve experienced firsthand the complexity of managing this file format effectively. Here is the content of the .sln file for the same simple solution:

We can see that solution folders are treated equally as projects and that a NestedProjects section defines the hierarchy. Also, the project configuration is duplicated for all projects. Each project is assigned a GUID, making it less user-friendly for humans.

The transition to the streamlined .slnx file format is a positive change for the entire .NET community. One concrete benefit I see is the improvement in handling solution file merge conflicts, a frequent and painful task for those on large teams. Because of GUIDs referencing other GUIDs the traditional .sln format makes resolving these conflicts nightmarish. The introduction of the new .slnx format promises significant enhancements, although XML is not the ideal format for resolving merge issues.

It echoes Microsoft’s earlier simplification of the .csproj C# project file format, which now includes only the essential information that a .NET IDE cannot infer:

What About Specific Project Configuration?

From Build > Configuration Manager…, you can adjust the UnitTests project settings to prevent it from compiling in Release mode. This is practical since tests are usually only run in Debug mode.

Project-Build-Configuration-Manager

Once changes are saved, the .slnx file content becomes:

Interestingly, when I converted a .sln file with an attached NDepend project file (.ndproj file extension) to .slnx, the resulting .slnx content was buggy. We use certain Visual Studio APIs to attach a .ndproj file to a solution, which seems to be unsupported at the moment. However, rest assured that with the official release of Visual Studio 2022 17.0, we will ensure compatibility with a new version of NDepend if needed.

How to Use .slnx File Format?

To use it:

  • You need Visual Studio 2022 17.13.x or higher installed.
  • In Tools > Options > Preview Features search for Use Solution File Persistence Model
  • In Visual Studio 2022 17.14.0 Preview 2 this option is not here anymore. The .slnx format is now a first-class citizen in this version.

slnx-Preview-Option

  • Then select the solution in the Solution Explorer panel. Then File > Save YourSolution.sln As…

Save-Visual-Studio-Solution-As

  • Saves as .slnx et voilà!

Saves-As-slnx

.slnx file extension is not yet per default associated with Visual Studio but you can bind it manually or drag and drop this file to VS 2022 Preview.

sln-slnx-side-by-side

.slnx and the CLI

To migrate an existing .sln solution file you can use the new command:

You can also build a solution from its .slnx file:

NDepend and .slnx

Finally with NDepend version 2025.1.1, the .slnx format is supported both to:

  • Attach an NDepend project to a .slnx solution file. This is only available with Visual Studio 17.14.0 and higher versions.
  • Reference one or several solutions to analyze from an NDepend project:

NDepend analyzing slnx solution