Microsoft has announced experimental support for .slnx
files in the .NET CLI v9.0.200, unifying the developer experience among the .NET tooling. This new feature aims to remove clutter in the solution file and to reduce friction when working with large solutions.
Traditionally, .sln
files have been the standard for Visual Studio solutions, but they come with limitations such as manual maintenance of project references and path dependencies, difficult merging of source code changes, and overall verbosity, as can be seen in this example:
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.9.34511.98
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotNetMonitorWebApp", "DotNetMonitorWebAppDotNetMonitorWebApp.csproj", "{1385B389-B20C-4D19-8FE0-85629BC41343}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{1385B389-B20C-4D19-8FE0-85629BC41343}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1385B389-B20C-4D19-8FE0-85629BC41343}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1385B389-B20C-4D19-8FE0-85629BC41343}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1385B389-B20C-4D19-8FE0-85629BC41343}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {C12E911E-FAA3-4ACE-B6BF-C3605E866483}
EndGlobalSection
EndGlobal
The new .slnx
format, based on XML and introduced in 2024, provides a more robust and flexible alternative, similar to project files in Visual Studio. It has a minimal footprint, removing the duplication of information already present in the project files. It uses a human-readable format that reduces the chances of accidental errors when manually editing the solution file.
<Solution>
<Project Path="DotNetMonitorWebAppDotNetMonitorWebApp.csproj" />
</Solution>
MSBuild already fully supports the .slnx
format since version 17.13. The experimental support for .NET CLI in version 9.0.200 allows developers to use .slnx
files directly with dotnet
commands (e.g., dotnet build
, dotnet test
). Visual Studio support for the new format might require developers enabling the ‘Use Solution File Persistence Model‘ option listed under Environment / Preview Features.
A new dotnet
command called migrate
helps developers convert their .sln
files into .slnx
files. Alternatively, from Visual Studio developers can right-click the solution node in the Solution Explorer and save the solution in the new format (if enabled in the preview options). The official recommendation is to keep either .sln
or .slnx
file, but not both of them in the solution folder.
The .slnx
file format is still officially in preview, with Microsoft encouraging developers to try the new format in their workflows and sharing their feedback with the appropriate tooling team owners. The stated goal is to make the new format the default in both Visual Studio and the .NET CLI tool. According to Microsoft, the new format will also work with legacy .NET Framework solutions.
Microsoft has also released a library called Microsoft.VisualStuidio.SolutionPersistence that allows programmatic access to both .sln and .slnx file operations. This allows third-party tools to leverage the new solution format without having to create a parser for it.
The comments by the developer community are mixed. Some praise the new format for simplicity and straightforward migration. Other developers think that new features such as globbing (dynamic project discovery inside a folder tree) should be added to the new format.