dotnet-sln - Man Page

Lists or modifies the projects in a .NET solution file.

dotnet sln

This article applies to: ✔️ .NET Core 3.1 SDK and later versions

Synopsis

dotnet sln [<SOLUTION_FILE>] [command]

dotnet sln [command] -h|--help

Description

The dotnet sln command provides a convenient way to list and modify projects in a solution file.

Create a solution file

To use the dotnet sln command, the solution file must already exist. If you need to create one, use the dotnet new command with the sln template name.

The following example creates a .sln file in the current folder, with the same name as the folder:

dotnet new sln

The following example creates a .sln file in the current folder, with the specified file name:

dotnet new sln --name MySolution

The following example creates a .sln file in the specified folder, with the same name as the folder:

dotnet new sln --output MySolution

Arguments

Options

Commands

list

Lists all projects in a solution file.

Synopsis

dotnet sln list [-h|--help]

Arguments

Options

add

Adds one or more projects to the solution file.

Synopsis

dotnet sln [<SOLUTION_FILE>] add [--in-root] [-s|--solution-folder <PATH>] <PROJECT_PATH> [<PROJECT_PATH>...]
dotnet sln add [-h|--help]

Arguments

Options

remove

Removes a project or multiple projects from the solution file.

Synopsis

dotnet sln [<SOLUTION_FILE>] remove <PROJECT_PATH> [<PROJECT_PATH>...]
dotnet sln [<SOLUTION_FILE>] remove [-h|--help]

Arguments

Options

Examples

See Also

Info

2023-10-25 .NET Documentation