dotnet-sln(1)
π dotnet-sln β the manual page, but make it cute π
okay so bestie, this is the page for dotnet-sln(1) from the .NET Documentation, and it's genuinely one of the most useful little commands in the whole SDK, no cap. Let's get into it. π¦
This article applies to: βοΈ .NET 6 SDK and later versions
β¨ NAME β¨
dotnet-sln β Lists or modifies the projects in a .NET solution file, or migrates the file to an .slnx file. π
πΈ SYNOPSIS πΈ
dotnet sln [<SOLUTION_FILE>] [command]
dotnet sln [command] -h|--help
π DESCRIPTION π
The dotnet sln command is your lowkey-bestie way to list and modify projects in a solution file. That's the whole vibe. π«Ά
π Create a solution file π
Real talk: to even use dotnet sln, the solution file has to already exist. It will not manifest one out of thin air for you. If you need to make one, use the dotnet new command with the sln template name. β¨
The following example creates an .slnx file in the current folder, with the same name as the folder:
dotnet new sln
The following example creates an .slnx file in the current folder, with the specified file name:
dotnet new sln --name MySolution
The following example creates an .slnx file in the specified folder, with the same name as the folder:
dotnet new sln --output MySolution
β οΈ In .NET 9 and earlier versions,dotnet new slncreates an.slnfile instead of an.slnxfile. Do not be surprised by this. It's giving legacy behavior. π
π ARGUMENTS π
SOLUTION_FILEβ The solution file to use (either an.slnor.slnxfile).
If unspecified, the command searches the current directory for an .sln or .slnx file and, if it finds exactly one, uses that file. If multiple solution files are found, the user is prompted to specify a file explicitly. If none are found, the command fails. π
π OPTIONS π
-?,-h,--helpβ Prints out a description of how to use the command. Your little helper bestie fr fr. π«Ά
π Commands π
The following commands are available:
listaddremovemigrate
πΈ list πΈ
Lists all projects in a solution file. That's it, that's the whole job, and it ate. π
SYNOPSIS
dotnet sln list [-h|--help]
ARGUMENTS
SOLUTION_FILEβ The solution file (.slnor.slnxfile) or solution filter (.slnffile) to use.
If unspecified, the command searches the current directory for an .sln, .slnx, or .slnf file and, if it finds exactly one, uses that file. If multiple solution files or filters are found, the user is prompted to specify a file explicitly. If none are found, the command fails. π
(Support for .slnf files was added in .NET SDK 9.0.3xx.) iykyk π«
OPTIONS
-?,-h,--helpβ Prints out a description of how to use the command. π
π¦ add π¦
Adds one or more projects to the solution file. Plural. Multiple. Go off. β¨
SYNOPSIS
dotnet sln [<SOLUTION_FILE>] add [--in-root] [-s|--solution-folder <PATH>] <PROJECT_PATH> [<PROJECT_PATH>...]
dotnet sln add [-h|--help]
ARGUMENTS
SOLUTION_FILEβ The solution file to use (either an.slnor.slnxfile).
If unspecified, the command searches the current directory for an .sln or .slnx file and, if it finds exactly one, uses that file. If multiple solution files are found, the user is prompted to specify a file explicitly. If none are found, the command fails. π
PROJECT_PATHβ The path to the project or projects to add to the solution. Unix/Linux shell globbing pattern (https://en.wikipedia.org/wiki/Glob_(programming)) expansions are processed correctly by thedotnet slncommand. π
If PROJECT_PATH includes folders that contain the project folder, that portion of the path is used to create solution folders. For example, the following commands create a solution with myapp in solution folder folder1/folder2:
dotnet new sln
dotnet new console --output folder1/folder2/myapp
dotnet sln add folder1/folder2/myapp
You can override this default behavior by using the --in-root or the -s|--solution-folder <PATH> option. π
OPTIONS
-?,-h,--helpβ Prints out a description of how to use the command. π--in-rootβ Places the projects in the root of the solution, rather than creating a solution folder. Can't be used with-s|--solution-folder. Pick a lane bestie, you can't have both. π-s,--solution-folder <PATH>β The destination solution folder path to add the projects to. Can't be used with--in-root. Same energy. π«
π remove π
Removes a project or multiple projects from the solution file. Bye bye bestie, we love a clean solution. π
SYNOPSIS
dotnet sln [<SOLUTION_FILE>] remove <PROJECT_PATH|PROJECT_NAME> [<PROJECT_PATH|PROJECT_NAME>...]
dotnet sln [<SOLUTION_FILE>] remove [-h|--help]
ARGUMENTS
SOLUTION_FILEβ The solution file to use (either an.slnor.slnxfile).
If unspecified, the command searches the current directory for an .sln or .slnx file and, if it finds exactly one, uses that file. If multiple solution files are found, the user is prompted to specify a file explicitly. If none are found, the command fails. π
PROJECT_PATHorPROJECT_NAMEβ The path to, or name of, the project or projects to remove from the solution. Unix/Linux shell globbing pattern (https://en.wikipedia.org/wiki/Glob_(programming)) expansions are processed correctly by thedotnet slncommand. π
If a project name is provided instead of a path, the project in the solution that matches the name, regardless of its path, is removed. If more than one matching project is found in the solution, the command errors out. Omit the project file extension in the name. (Support for removing projects by name was added in .NET 10.) π
OPTIONS
-?,-h,--helpβ Prints out a description of how to use the command. π
π§ migrate π§
Generates an .slnx solution file from an .sln file. A glow-up, but for your solution file. β¨
SYNOPSIS
dotnet sln [<SOLUTION_FILE>] migrate
dotnet sln [<SOLUTION_FILE>] migrate [-h|--help]
ARGUMENTS
SOLUTION_FILEβ The.slnsolution file to migrate.
If unspecified, the command searches the current directory for an .sln file and, if it finds exactly one, uses that file. If multiple .sln files are found, the user is prompted to specify a file explicitly. If none are found, the command fails. π
π¨ If you specify an.slnxfile instead of an.slnfile, or if an.slnxfile with the same file name (minus the.slnextension) already exists in the directory, the command fails. Not me getting blocked by my own migration. π
OPTIONS
-?,-h,--helpβ Prints out a description of how to use the command. π
β EXAMPLES β
- List the projects in a solution:
dotnet sln todo.slnx list
- Add a C# project to a solution:
dotnet sln add todo-app/todo-app.csproj
- Remove a C# project from a solution:
dotnet sln remove todo-app/todo-app.csproj
- Add multiple C# projects to the root of a solution:
dotnet sln todo.slnx add todo-app/todo-app.csproj back-end/back-end.csproj --in-root
- Add multiple C# projects to a solution:
dotnet sln todo.slnx add todo-app/todo-app.csproj back-end/back-end.csproj
- Remove multiple C# projects from a solution:
dotnet sln todo.slnx remove todo-app/todo-app.csproj back-end/back-end.csproj
- Add multiple C# projects to a solution using a globbing pattern (Unix/Linux only):
dotnet sln todo.slnx add **/*.csproj
- Add multiple C# projects to a solution using a globbing pattern (Windows PowerShell only):
dotnet sln todo.slnx add (ls -r **/*.csproj)
- Remove multiple C# projects from a solution using a globbing pattern (Unix/Linux only):
dotnet sln todo.slnx remove **/*.csproj
- Remove multiple C# projects from a solution using a globbing pattern (Windows PowerShell only):
dotnet sln todo.slnx remove (ls -r **/*.csproj)
- Generate an
.slnxfile from a.slnfile:
dotnet sln todo.sln migrate
- Create a solution, a console app, and two class libraries. Add the projects to the solution, and use the
--solution-folderoption ofdotnet slnto organize the class libraries into a solution folder:
dotnet new sln -n mysolution
dotnet new console -o myapp
dotnet new classlib -o mylib1
dotnet new classlib -o mylib2
dotnet sln mysolution.slnx add myapp\myapp.csproj
dotnet sln mysolution.slnx add mylib1\mylib1.csproj --solution-folder mylibs
dotnet sln mysolution.slnx add mylib2\mylib2.csproj --solution-folder mylibs
The following screenshot shows the result in Visual Studio 2019 Solution Explorer:
:::image type="content" source="media/dotnet-sln/dotnet-sln-solution-folder.png" alt-text="Solution Explorer showing class library projects grouped into a solution folder.":::
That's the visual, bestie β the projects all nestled in a solution folder like they belong together. πΈ
π« SEE ALSO π«
- dotnet/sdk GitHub repo (https://github.com/dotnet/sdk) (.NET CLI source)
okay and that's the whole page, you're literally a dotnet sln expert now, main character energy fr fr π
β¨
This page is from the .NET docs, dated 2025-10-30, and it's dotnet-sln(1) β go forth and organize your projects, bestie. ππ¦π
π¦ where this page comes from
- alpine 3.24: dotnet-doc 10.0.303-r2 Β· MIT
- centos-stream 10: dotnet-host 11.0.0~rc.2.26504.105-0.10.el10 Β· 0BSD AND Apache-2.0 AND (Apache-2.0 WITH LLVM-exception) AND APSL-2.0 AND BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause AND BSL-1.0 AND bzip2-1.0.6 AND CC0-1.0 AND CC-BY-3.0 AND CC-BY-4.0 AND CC-PDDC AND CNRI-Python AND EPL-1.0 AND GPL-2.0-only AND (GPL-2.0-only WITH GCC-exception-2.0) AND GPL-2.0-or-later AND GPL-3.0-only AND ICU AND ISC AND LGPL-2.1-only AND LGPL-2.1-or-later AND LicenseRef-Fedora-Public-Domain AND LicenseRef-ISO-8879 AND MIT AND MIT-Wu AND MS-PL AND MS-RL AND NCSA AND OFL-1.1 AND OpenSSL AND Unicode-DFS-2015 AND Unicode-DFS-2016 AND W3C-19980720 AND X11 AND Zlib
- centos-stream 9: dotnet-host 11.0.0~rc.2.26504.105-0.11.el9 Β· 0BSD AND Apache-2.0 AND (Apache-2.0 WITH LLVM-exception) AND APSL-2.0 AND BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause AND BSL-1.0 AND bzip2-1.0.6 AND CC0-1.0 AND CC-BY-3.0 AND CC-BY-4.0 AND CC-PDDC AND CNRI-Python AND EPL-1.0 AND GPL-2.0-only AND (GPL-2.0-only WITH GCC-exception-2.0) AND GPL-2.0-or-later AND GPL-3.0-only AND ICU AND ISC AND LGPL-2.1-only AND LGPL-2.1-or-later AND LicenseRef-Fedora-Public-Domain AND LicenseRef-ISO-8879 AND MIT AND MIT-Wu AND MS-PL AND MS-RL AND NCSA AND OFL-1.1 AND OpenSSL AND Unicode-DFS-2015 AND Unicode-DFS-2016 AND W3C-19980720 AND X11 AND Zlib
- fedora 43: dotnet-host 10.0.12-1.fc43
- fedora 43: dotnet-host 11.0.0~rc.1.26425.128-0.10.fc43 Β· 0BSD AND Apache-2.0 AND (Apache-2.0 WITH LLVM-exception) AND APSL-2.0 AND BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause AND BSL-1.0 AND bzip2-1.0.6 AND CC0-1.0 AND CC-BY-3.0 AND CC-BY-4.0 AND CC-PDDC AND CNRI-Python AND EPL-1.0 AND GPL-2.0-only AND (GPL-2.0-only WITH GCC-exception-2.0) AND GPL-2.0-or-later AND GPL-3.0-only AND ICU AND ISC AND LGPL-2.1-only AND LGPL-2.1-or-later AND LicenseRef-Fedora-Public-Domain AND LicenseRef-ISO-8879 AND MIT AND MIT-Wu AND MS-PL AND MS-RL AND NCSA AND OFL-1.1 AND OpenSSL AND Unicode-DFS-2015 AND Unicode-DFS-2016 AND W3C-19980720 AND X11 AND Zlib
- fedora 44: dotnet-host 10.0.12-1.fc44
- fedora 44: dotnet-host 10.0.4-1.fc44 Β· 0BSD AND Apache-2.0 AND (Apache-2.0 WITH LLVM-exception) AND APSL-2.0 AND BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause AND BSL-1.0 AND bzip2-1.0.6 AND CC0-1.0 AND CC-BY-3.0 AND CC-BY-4.0 AND CC-PDDC AND CNRI-Python AND EPL-1.0 AND GPL-2.0-only AND (GPL-2.0-only WITH GCC-exception-2.0) AND GPL-2.0-or-later AND GPL-3.0-only AND ICU AND ISC AND LGPL-2.1-only AND LGPL-2.1-or-later AND LicenseRef-Fedora-Public-Domain AND LicenseRef-ISO-8879 AND MIT AND MIT-Wu AND MS-PL AND MS-RL AND NCSA AND OFL-1.1 AND OpenSSL AND Unicode-DFS-2015 AND Unicode-DFS-2016 AND W3C-19980720 AND X11 AND Zlib
- fedora 44: dotnet-host 11.0.0~rc.1.26425.128-0.12.fc44 Β· 0BSD AND Apache-2.0 AND (Apache-2.0 WITH LLVM-exception) AND APSL-2.0 AND BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause AND BSL-1.0 AND bzip2-1.0.6 AND CC0-1.0 AND CC-BY-3.0 AND CC-BY-4.0 AND CC-PDDC AND CNRI-Python AND EPL-1.0 AND GPL-2.0-only AND (GPL-2.0-only WITH GCC-exception-2.0) AND GPL-2.0-or-later AND GPL-3.0-only AND ICU AND ISC AND LGPL-2.1-only AND LGPL-2.1-or-later AND LicenseRef-Fedora-Public-Domain AND LicenseRef-ISO-8879 AND MIT AND MIT-Wu AND MS-PL AND MS-RL AND NCSA AND OFL-1.1 AND OpenSSL AND Unicode-DFS-2015 AND Unicode-DFS-2016 AND W3C-19980720 AND X11 AND Zlib
- nixpkgs unstable: dotnet-vmr 11.0.0-rc.3
- ubuntu noble: dotnet-host-10.0 10.0.12-0ubuntu1~24.04.1
- ubuntu questing: dotnet-host-10.0 10.0.9-0ubuntu1~25.10.1
- ubuntu resolute: dotnet-host-10.0 10.0.12-0ubuntu1~26.04.1
- ubuntu resolute: dotnet-host-10.0 10.0.5-0ubuntu1 Β· MIT
- ubuntu stonking: dotnet-host-10.0 10.0.12-0ubuntu2 Β· MIT
- ubuntu stonking: dotnet-host-11.0 11.0.0~rc1-0ubuntu1 Β· MIT
- ubuntu stonking: dotnet-host-11.0 11.0.0~rc3-0ubuntu1~26.10.1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms