diff --git a/docs/core/compatibility/10.0.md b/docs/core/compatibility/10.0.md index fc4ed826430ea..971c193e7ea29 100644 --- a/docs/core/compatibility/10.0.md +++ b/docs/core/compatibility/10.0.md @@ -105,6 +105,7 @@ If you're migrating an app to .NET 10, the breaking changes listed here might af | [.NET CLI `--interactive` defaults to `true` in user scenarios](sdk/10.0/dotnet-cli-interactive.md) | Behavioral change | Preview 3 | | [.NET tool packaging creates RuntimeIdentifier-specific tool packages](sdk/10.0/dotnet-tool-pack-publish.md) | Behavioral change | Preview 6 | | [Default workload configuration from 'loose manifests' to 'workload sets' mode](sdk/10.0/default-workload-config.md) | Behavioral change | Preview 2 | +| [`dotnet new sln` defaults to SLNX file format](sdk/10.0/dotnet-new-sln-slnx-default.md) | Behavioral change | RC 1 | | [`dotnet package list` performs restore](sdk/10.0/dotnet-package-list-restore.md) | Behavioral change | Preview 4 | | [`dotnet restore` audits transitive packages](sdk/10.0/nugetaudit-transitive-packages.md) | Behavioral change | Preview 3 | | [project.json not supported in `dotnet restore`](sdk/10.0/dotnet-restore-project-json-unsupported.md) | Source incompatible | Preview 7 | diff --git a/docs/core/compatibility/sdk/10.0/dotnet-new-sln-slnx-default.md b/docs/core/compatibility/sdk/10.0/dotnet-new-sln-slnx-default.md new file mode 100644 index 0000000000000..4c813a700b558 --- /dev/null +++ b/docs/core/compatibility/sdk/10.0/dotnet-new-sln-slnx-default.md @@ -0,0 +1,65 @@ +--- +title: "Breaking change - `dotnet new sln` defaults to SLNX file format" +description: "Learn about the breaking change in .NET 10 where `dotnet new sln` creates SLNX-format solution files instead of SLN-format files." +ms.date: 08/30/2025 +ai-usage: ai-assisted +ms.custom: https://github.com/dotnet/docs/issues/48192 +--- + +# `dotnet new sln` defaults to SLNX file format + +In .NET 10, `dotnet new sln` generates an [SLNX-format](https://devblogs.microsoft.com/visualstudio/new-simpler-solution-file-format/) solution file instead of an SLN-formatted solution file. + +## Version introduced + +.NET 10 RC 1 + +## Previous behavior + +Previously, `dotnet new sln` created a SLN-format solution file similar to: + +```sln +# Visual Studio Version 17 +VisualStudioVersion = 17.0.31903.59 +MinimumVisualStudioVersion = 10.0.40219.1 +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal +``` + +## New behavior + +Starting in .NET 10, `dotnet new sln` creates a SLNX-format solution file similar to: + +```xml + + +``` + +## Type of breaking change + +This change is a [behavioral change](../../categories.md#behavioral-change). + +## Reason for change + +The .NET SDK [added support for SLNX files](https://devblogs.microsoft.com/dotnet/introducing-slnx-support-dotnet-cli/) in version 9.0.200, and it's proven to be a stable, understandable format for developers. It's well-supported by all major .NET tooling and is much easier for developers to maintain. This breaking change aims to encourage the use of the SLNX format. + +## Recommended action + +If you desire an SLN-formatted solution file, pass the `--format sln` option to the command: + +`dotnet new sln --format sln` + +## Affected APIs + +None. + +## See also + +- [.NET default templates for dotnet new](../../../tools/dotnet-new-sdk-templates.md) diff --git a/docs/core/compatibility/toc.yml b/docs/core/compatibility/toc.yml index 4a81877a15947..9a56a8726e7a3 100644 --- a/docs/core/compatibility/toc.yml +++ b/docs/core/compatibility/toc.yml @@ -118,6 +118,8 @@ items: href: sdk/10.0/dotnet-restore-project-json-unsupported.md - name: Default workload configuration from 'loose manifests' to 'workload sets' mode href: sdk/10.0/default-workload-config.md + - name: "`dotnet new sln` defaults to SLNX file format" + href: sdk/10.0/dotnet-new-sln-slnx-default.md - name: "`dotnet package list` performs restore" href: sdk/10.0/dotnet-package-list-restore.md - name: MSBUILDCUSTOMBUILDEVENTWARNING escape hatch removed diff --git a/docs/core/tools/dotnet-sln.md b/docs/core/tools/dotnet-sln.md index 098939ca8264e..4c392953e883d 100644 --- a/docs/core/tools/dotnet-sln.md +++ b/docs/core/tools/dotnet-sln.md @@ -1,7 +1,7 @@ --- title: dotnet sln command description: The dotnet-sln command provides a convenient option to add, remove, and list projects in a solution file. -ms.date: 03/26/2025 +ms.date: 08/29/2025 --- # dotnet sln @@ -27,24 +27,27 @@ The `dotnet sln` command provides a convenient way to list and modify projects i To use the `dotnet sln` command, the solution file must already exist. If you need to create one, use the [dotnet new](dotnet-new.md) command with the `sln` template name. -The following example creates a *.sln* file in the current folder, with the same name as the folder: +The following example creates an *.slnx* file in the current folder, with the same name as the folder: ```dotnetcli dotnet new sln ``` -The following example creates a *.sln* file in the current folder, with the specified file name: +The following example creates an *.slnx* file in the current folder, with the specified file name: ```dotnetcli dotnet new sln --name MySolution ``` -The following example creates a *.sln* file in the specified folder, with the same name as the folder: +The following example creates an *.slnx* file in the specified folder, with the same name as the folder: ```dotnetcli dotnet new sln --output MySolution ``` +> [!NOTE] +> In .NET 9 and earlier versions, `dotnet new sln` creates an *.sln* file instead of an *.slnx* file. + ## Arguments - **`SOLUTION_FILE`**