{"id":55826,"date":"2025-03-13T10:30:00","date_gmt":"2025-03-13T17:30:00","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/dotnet\/?p=55826"},"modified":"2025-07-24T13:38:46","modified_gmt":"2025-07-24T20:38:46","slug":"introducing-slnx-support-dotnet-cli","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/dotnet\/introducing-slnx-support-dotnet-cli\/","title":{"rendered":"Introducing support for SLNX, a new, simpler solution file format in the .NET CLI"},"content":{"rendered":"<p>Solution files have been a part of the .NET and Visual Studio experience for many years now, and they&#8217;ve had the same custom format the whole time. Recently, the <a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/new-simpler-solution-file-format\">Visual Studio solution team has begun previewing a new<\/a>, XML-based solution file format called SLNX. Starting in .NET SDK 9.0.200, the <code>dotnet<\/code> CLI supports building and interacting with these files in the same way as it does with existing solution files. In the rest of this post we&#8217;ll show how users can migrate to the new format, explore the new support across the <code>dotnet<\/code> CLI, and discuss the next steps towards a generally-available release of the format.<\/p>\n<h2>Getting started<\/h2>\n<p>Before the 9.0.200 SDK, the only way to create a SLNX file was through the Visual Studio settings. The <code>Environment &gt; Preview Features &gt; Use Solution File Persistence Model<\/code> setting, when checked, would allow users to <code>Save As<\/code> their existing <code>.sln<\/code> files in the new <code>.slnx<\/code> format. Starting in Visual Studio 17.14, this feature is stable and generally available.<\/p>\n<p>The 9.0.200 SDK provides a command to do this same migration: <code>dotnet sln migrate<\/code>.<\/p>\n<p>Let&#8217;s start with a very simple solution and project setup to look at what it takes to migrate. First, we&#8217;ll create a new solution:<\/p>\n<pre><code class=\"language-powershell\">PS C:\\Users\\chethusk\\Code\\example&gt; dotnet new sln\nThe template \"Solution File\" was created successfully.\n\nPS C:\\Users\\chethusk\\Code\\example&gt; cat .\\example.sln\n\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio Version 17\nVisualStudioVersion = 17.0.31903.59\nMinimumVisualStudioVersion = 10.0.40219.1\nGlobal\n        GlobalSection(SolutionConfigurationPlatforms) = preSolution\n                Debug|Any CPU = Debug|Any CPU\n                Release|Any CPU = Release|Any CPU\n        EndGlobalSection\n        GlobalSection(SolutionProperties) = preSolution\n                HideSolutionNode = FALSE\n        EndGlobalSection\nEndGlobal<\/code><\/pre>\n<p>Now, we&#8217;ll create a project and add it to the solution:<\/p>\n<pre><code class=\"language-powershell\">\nPS C:\\Users\\chethusk\\Code\\example&gt; dotnet new console -n my-app\nThe template \"Console App\" was created successfully.\n\nProcessing post-creation actions...\nRestoring C:\\Users\\chethusk\\Code\\example\\my-app\\my-app.csproj:\nRestore succeeded.\n\nPS C:\\Users\\chethusk\\Code\\example&gt; dotnet sln add .\\my-app\\\nProject `my-app\\my-app.csproj` added to the solution.\n\nPS C:\\Users\\chethusk\\Code\\example&gt; cat .\\example.sln\n\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio Version 17\nVisualStudioVersion = 17.0.31903.59\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"my-app\", \"my-app\\my-app.csproj\", \"{845B7716-6F03-4D02-8E86-79F95485B5D7}\"\nEndProject\nGlobal\n        GlobalSection(SolutionConfigurationPlatforms) = preSolution\n                Debug|Any CPU = Debug|Any CPU\n                Debug|x64 = Debug|x64\n                Debug|x86 = Debug|x86\n                Release|Any CPU = Release|Any CPU\n                Release|x64 = Release|x64\n                Release|x86 = Release|x86\n        EndGlobalSection\n        GlobalSection(ProjectConfigurationPlatforms) = postSolution\n                {845B7716-6F03-4D02-8E86-79F95485B5D7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n                {845B7716-6F03-4D02-8E86-79F95485B5D7}.Debug|Any CPU.Build.0 = Debug|Any CPU\n                {845B7716-6F03-4D02-8E86-79F95485B5D7}.Debug|x64.ActiveCfg = Debug|Any CPU\n                {845B7716-6F03-4D02-8E86-79F95485B5D7}.Debug|x64.Build.0 = Debug|Any CPU\n                {845B7716-6F03-4D02-8E86-79F95485B5D7}.Debug|x86.ActiveCfg = Debug|Any CPU\n                {845B7716-6F03-4D02-8E86-79F95485B5D7}.Debug|x86.Build.0 = Debug|Any CPU\n                {845B7716-6F03-4D02-8E86-79F95485B5D7}.Release|Any CPU.ActiveCfg = Release|Any CPU\n                {845B7716-6F03-4D02-8E86-79F95485B5D7}.Release|Any CPU.Build.0 = Release|Any CPU\n                {845B7716-6F03-4D02-8E86-79F95485B5D7}.Release|x64.ActiveCfg = Release|Any CPU\n                {845B7716-6F03-4D02-8E86-79F95485B5D7}.Release|x64.Build.0 = Release|Any CPU\n                {845B7716-6F03-4D02-8E86-79F95485B5D7}.Release|x86.ActiveCfg = Release|Any CPU\n                {845B7716-6F03-4D02-8E86-79F95485B5D7}.Release|x86.Build.0 = Release|Any CPU\n        EndGlobalSection\n        GlobalSection(SolutionProperties) = preSolution\n                HideSolutionNode = FALSE\n        EndGlobalSection\nEndGlobal<\/code><\/pre>\n<p>Now, let&#8217;s convert our solution to the new format:<\/p>\n<pre><code class=\"language-powershell\">PS C:\\Users\\chethusk\\Code\\example&gt; dotnet sln migrate\n.slnx file C:\\Users\\chethusk\\Code\\example\\example.slnx generated.\nPS C:\\Users\\chethusk\\Code\\example&gt; cat .\\example.slnx\n&lt;Solution&gt;\n  &lt;Configurations&gt;\n    &lt;Platform Name=\"Any CPU\" \/&gt;\n    &lt;Platform Name=\"x64\" \/&gt;\n    &lt;Platform Name=\"x86\" \/&gt;\n  &lt;\/Configurations&gt;\n  &lt;Project Path=\"my-app\/my-app.csproj\" \/&gt;\n&lt;\/Solution&gt;<\/code><\/pre>\n<p>The new format is XML-based and is much more concise than the old format &#8211; but it contains all of the same data! The data that is missing from the new format is part of the defaults of the format, so no functionality is lost.<\/p>\n<p>This migration is made possible because the Visual Studio Solution team has created a new open-source library for parsing and working with both classic and XML-based solution files &#8211; the library is called <a href=\"https:\/\/github.com\/microsoft\/vs-solutionpersistence\">Microsoft.VisualStudio.SolutionPersistence<\/a>.<\/p>\n<h2>Managing projects from the CLI<\/h2>\n<p>You can do more than migrating solution files using the CLI, too. As you might expect, you can build the new solutions the same way you would build the old:<\/p>\n<pre><code class=\"language-powershell\">PS C:\\Users\\chethusk\\Code\\example&gt; dotnet build .\\example.slnx\nRestore complete (0.6s)\n  my-app succeeded (4.3s) \u2192 my-app\\bin\\Debug\\net9.0\\my-app.dll\n\nBuild succeeded in 5.3s<\/code><\/pre>\n<p><div class=\"alert alert-primary\"><p class=\"alert-divider\"><i class=\"fabric-icon fabric-icon--Info\"><\/i><strong>Note<\/strong><\/p> We specified the <code>.slnx<\/code> file explicitly above because it&#8217;s an error to run <code>dotnet build<\/code> or other commands that need to build in a directory with both a <code>.sln<\/code> and a <code>.slnx<\/code> &#8211; we don&#8217;t know which one to build!<\/div><\/p>\n<p>All of the other interactions you expect from the <code>dotnet<\/code> CLI work as well. We can add projects:<\/p>\n<pre><code class=\"language-powershell\">PS C:\\Users\\chethusk\\Code\\example&gt; dotnet new classlib -n my-lib\nThe template \"Class Library\" was created successfully.\n\nProcessing post-creation actions...\nRestoring C:\\Users\\chethusk\\Code\\example\\my-lib\\my-lib.csproj:\nRestore succeeded.\n\nPS C:\\Users\\chethusk\\Code\\example&gt; dotnet sln .\\example.slnx add my-lib\nProject `my-lib\\my-lib.csproj` added to the solution.\n\nPS C:\\Users\\chethusk\\Code\\example&gt; cat .\\example.slnx\n&lt;Solution&gt;\n  &lt;Configurations&gt;\n    &lt;Platform Name=\"Any CPU\" \/&gt;\n    &lt;Platform Name=\"x64\" \/&gt;\n    &lt;Platform Name=\"x86\" \/&gt;\n  &lt;\/Configurations&gt;\n  &lt;Project Path=\"my-app\/my-app.csproj\" \/&gt;\n  &lt;Project Path=\"my-lib\/my-lib.csproj\" \/&gt;\n&lt;\/Solution&gt;<\/code><\/pre>\n<p>We can list the projects in a solution:<\/p>\n<pre><code class=\"language-powershell\">PS C:\\Users\\chethusk\\Code\\example&gt; dotnet sln .\\example.slnx list\nProject(s)\n----------\nmy-app\\my-app.csproj\nmy-lib\\my-lib.csproj<\/code><\/pre>\n<p>And finally we can remove projects from the solution:<\/p>\n<pre><code class=\"language-powershell\">PS C:\\Users\\chethusk\\Code\\example&gt; dotnet sln .\\example.slnx remove .\\my-lib\\\nProject `my-lib\\my-lib.csproj` removed from the solution.\n\nPS C:\\Users\\chethusk\\Code\\example&gt; cat .\\example.slnx\n&lt;Solution&gt;\n  &lt;Configurations&gt;\n    &lt;Platform Name=\"Any CPU\" \/&gt;\n    &lt;Platform Name=\"x64\" \/&gt;\n    &lt;Platform Name=\"x86\" \/&gt;\n  &lt;\/Configurations&gt;\n  &lt;Project Path=\"my-app\/my-app.csproj\" \/&gt;\n&lt;\/Solution&gt;<\/code><\/pre>\n<p><div class=\"alert alert-success\"><p class=\"alert-divider\"><i class=\"fabric-icon fabric-icon--Lightbulb\"><\/i><strong>Tip<\/strong><\/p>There are two commands that <em>don&#8217;t<\/em> work in 9.0.200, though &#8211; <code>dotnet nuget why<\/code> and <code>dotnet list package<\/code> &#8211; those will begin working in the 9.0.201 release in March.<\/div><\/p>\n<h2>Support for SLNX across .NET IDEs and Tooling<\/h2>\n<p>As mentioned above, the <code>dotnet<\/code> CLI has broad support for the new SLNX file format, but there are still many tools in the ecosystem that have partial or no support for the format. You will need to take this varying level of support into account when choosing whether to migrate to SLNX files. Some examples of tools that have varying levels of support for slnx today are:<\/p>\n<h3>Visual Studio<\/h3>\n<p>While the IDE will read the SLNX file when loaded, it currently will not load SLNX files unless the setting to enable SLNX persistence has been enabled. This means if you work on a team and users have not toggled this setting, they will not be able to open SLNX files at all. In addition, double-clicking on SLNX files doesn&#8217;t currently open Visual Studio instances the way that sln files do.<\/p>\n<p><iframe width=\"800\" height=\"450\" src=\"https:\/\/www.youtube.com\/embed\/Iwc3jGCbt5A?si=Q4fkgrx2lsRT50E8\" allowfullscreen><\/iframe><\/p>\n<h3>C# Dev Kit<\/h3>\n<p>C# DevKit can support SLNX files, but in order to do so you must set the <code>dotnet.defaultSolution<\/code> property to the path to your slnx file:<\/p>\n<pre><code class=\"language-json\">{\n  \"dotnet.defaultSolution\": \"example.slnx\"\n}<\/code><\/pre>\n<h3>slngen<\/h3>\n<p>The <a href=\"https:\/\/microsoft.github.io\/slngen\/\">slngen<\/a> tool is a command-line utility used to synthesize a solution file for a given project to help make repos that prefer not to use solution files interoperate better with Visual Studio. This tool is not yet updated to support SLNX &#8211; the status of this support can be tracked at <a href=\"https:\/\/github.com\/microsoft\/slngen\/issues\/643\">microsoft\/slngen#643<\/a>.<\/p>\n<h3>JetBrains Rider<\/h3>\n<p>Rider has preliminary support for the SLNX format, and details about their support can be tracked at <a href=\"https:\/\/youtrack.jetbrains.com\/issue\/RIDER-110777\">RIDER-110777<\/a>.<\/p>\n<h2>Feedback and the road to GA<\/h2>\n<p>Despite this end-to-end support in Visual Studio and the <code>dotnet<\/code> CLI, the SLNX format itself is in its infancy. While we think it&#8217;s a great step forward in usability for many .NET developers, we want to hear from you as you try it in your teams. Try the migration paths in Visual Studio and the <code>dotnet<\/code> CLI, make sure things work as you expect in your CI\/CD pipelines and local builds, and make sure to let the teams know about your experiences in the following ways:<\/p>\n<ul>\n<li>for CLI experiences, report new issues or discussions at the <a href=\"https:\/\/github.com\/dotnet\/sdk\">dotnet\/sdk<\/a> repository<\/li>\n<li>for Visual Studio experiences, please raise new tickets at the <a href=\"https:\/\/developercommunity.visualstudio.com\/\">Visual Studio Developer Community<\/a><\/li>\n<li>for feature requests for the solution parsing library, report new issues at the <a href=\"https:\/\/github.com\/microsoft\/vs-solutionpersistence\">microsoft\/vs-solutionpersistence<\/a> repository<\/li>\n<\/ul>\n<p>As we&#8217;re able to respond to your feedback and solidify core user experiences, we move closer towards being able to make this the default for Visual Studio and the <code>dotnet<\/code> CLI.<\/p>\n<h2>Summary<\/h2>\n<p>SLNX files are an exciting new change to the solution file format that we think will make it easier for teams to collaborate and understand their projects. The new capabilities in the <code>dotnet<\/code> CLI allow developers to have a full inner-loop and CI experience using the new format, so we&#8217;d love for .NET developers to read through the <a href=\"https:\/\/learn.microsoft.com\/dotnet\/core\/tools\/dotnet-sln\">updated documentation<\/a>, try the new support, and give us feedback!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Learn about the .NET CLI&#8217;s ability to interact with the new XML-based solution file format.<\/p>\n","protected":false},"author":74549,"featured_media":57384,"comment_status":"open","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[685,646],"tags":[7829,7906],"class_list":["post-55826","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dotnet","category-visual-studio","tag-dotnet-cli","tag-slnx"],"acf":[],"blog_post_summary":"<p>Learn about the .NET CLI&#8217;s ability to interact with the new XML-based solution file format.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts\/55826","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/users\/74549"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/comments?post=55826"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts\/55826\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/media\/57384"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/media?parent=55826"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/categories?post=55826"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/tags?post=55826"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}