Skip to content

Commit bf5a621

Browse files
authored
dotnet sln add breaking change (#43931)
1 parent 53ac700 commit bf5a621

File tree

3 files changed

+52
-0
lines changed

3 files changed

+52
-0
lines changed

docs/core/compatibility/9.0.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ If you're migrating an app to .NET 9, the breaking changes listed here might aff
100100
| Title | Type of change | Introduced version |
101101
|-------------------------------------------------------------------------------|-------------------|--------------------|
102102
| [`dotnet restore` audits transitive packages](sdk/9.0/nugetaudit-transitive-packages.md) | Behavioral change | Preview 6 |
103+
| [`dotnet sln add` doesn't allow invalid file names](sdk/9.0/dotnet-sln.md) | Behavioral change | 9.0.2xx |
103104
| [`dotnet watch` incompatible with Hot Reload for old frameworks](sdk/9.0/dotnet-watch.md) | Behavioral change | RC 1 |
104105
| [`dotnet workload` commands output change](sdk/9.0/dotnet-workload-output.md) | Behavioral change | Preview 1 |
105106
| [`installer` repo version no longer documented](sdk/9.0/productcommits-versions.md) | Behavioral change | Preview 5 |
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
title: "'dotnet sln add' no longer allows invalid file names"
3+
description: Learn about the breaking change in the .NET SDK where the CLI command 'dotnet sln add' adds support for .slnx solution files and no longer allows invalid file names.
4+
ms.date: 12/10/2024
5+
ai-usage: ai-assisted
6+
ms.custom: https://github.com/dotnet/docs/issues/43882
7+
---
8+
9+
# `dotnet sln add` no longer allows invalid file names
10+
11+
Starting in .NET SDK 9.0.2xx, the [`dotnet sln add`](../../../tools/dotnet-sln.md#add) CLI command includes support for *.slnx* solution files using the [vs-solutionpersistence](https://github.com/microsoft/vs-solutionpersistence) serializer. As a result, slight changes in behavior are expected.
12+
13+
## Version introduced
14+
15+
.NET SDK 9.0.2xx
16+
17+
## Previous behavior
18+
19+
Previously, projects and solution folders could have invalid Windows file names. They could also have invalid characters in their names. In addition, `dotnet sln add` failed if you attempted to add a nested project with the same name as an existing project.
20+
21+
## New behavior
22+
23+
Starting in .NET SDK 9.0.2xx, projects and solution folder names:
24+
25+
- Can't be a DOS word: `NUL`, `CON`, `AUX`, `PRN`, `COM?`, `LPT?`, or `CLOCK$` (where `?` is any number of digits).
26+
- Must be 260 characters or less.
27+
- Can't contain invalid characters, such as control characters or `?`, `:`, `\`, `/`, `*`, `"`, `"`, `<`, `>`, and `|`.
28+
29+
In addition, `dotnet sln add` now succeeds if you attempt to add a nested project with the same name as an existing project, which mimics the behavior for non-nested projects. Example: Adding `folder/project.csproj` and `parent/child/project.csproj` doesn't result in an error.
30+
31+
Exceptions contain the current strings, but wrap error messages from [vs-solutionpersistence](https://github.com/microsoft/vs-solutionpersistence).
32+
33+
## Type of breaking change
34+
35+
This change is a [behavioral change](../../categories.md#behavioral-change).
36+
37+
## Reason for change
38+
39+
These changes were introduced to transition to the new `vs-solutionpersistence` serializer.
40+
41+
## Recommended action
42+
43+
Review project and solution folders names to ensure they comply with the new naming restrictions.
44+
45+
## Affected APIs
46+
47+
N/A

docs/core/compatibility/toc.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ items:
106106
items:
107107
- name: "`dotnet restore` audits transitive packages"
108108
href: sdk/9.0/nugetaudit-transitive-packages.md
109+
- name: "`dotnet sln add` doesn't allow invalid file names"
110+
href: sdk/9.0/dotnet-sln.md
109111
- name: "`dotnet watch` incompatible with Hot Reload for old frameworks"
110112
href: sdk/9.0/dotnet-watch.md
111113
- name: "`dotnet workload` commands output change"
@@ -1810,6 +1812,8 @@ items:
18101812
items:
18111813
- name: "`dotnet restore` audits transitive packages"
18121814
href: sdk/9.0/nugetaudit-transitive-packages.md
1815+
- name: "`dotnet sln add` doesn't allow invalid file names"
1816+
href: sdk/9.0/dotnet-sln.md
18131817
- name: "`dotnet watch` incompatible with Hot Reload for old frameworks"
18141818
href: sdk/9.0/dotnet-watch.md
18151819
- name: "`dotnet workload` commands output change"

0 commit comments

Comments
 (0)