1dotnet sln command(1)              .NET Core             dotnet sln command(1)
2
3
4

dotnet sln

6       This article applies to: ✓ .NET Core 1.x SDK and later versions
7

NAME

9       dotnet sln - Modifies a .NET Core solution file.
10

SYNOPSIS

12              dotnet sln [<SOLUTION_FILE>] [command] [-h|--help]
13

DESCRIPTION

15       The  dotnet  sln  command provides a convenient way to add, remove, and
16       list projects in a solution file.
17
18       To use the dotnet sln command, the solution file  must  already  exist.
19       If you need to create one, use the dotnet new command, like in the fol‐
20       lowing example:
21
22              dotnet new sln
23
24   Arguments
25       · SOLUTION_FILE
26
27         The solution file to use.  If not specified, the command searches the
28         current  directory  for one.  If there are multiple solution files in
29         the directory, one must be specified.
30

OPTIONS

32       · -h|--help
33
34         Prints out a short help for the command.
35
36   Commands
37   add
38       Adds a project or multiple projects to the solution file.
39

SYNOPSIS

41              dotnet sln [<SOLUTION_FILE>] add [--in-root] [-s|--solution-folder] <PROJECT_PATH>
42              dotnet sln add [-h|--help]
43
44   Arguments
45       · SOLUTION_FILE
46
47         The solution file to use.  If not specified, the command searches the
48         current  directory  for one.  If there are multiple solution files in
49         the directory, one must be specified.
50
51       · PROJECT_PATH
52
53         The path to the  project  to  add  to  the  solution.   Add  multiple
54         projects   by  adding  one  after  the  other  separated  by  spaces.
55         Unix/Linux shell globbing pattern expansions are processed  correctly
56         by the dotnet sln command.
57

OPTIONS

59       · -h|--help
60
61         Prints out a short help for the command.
62
63       · --in-root
64
65         Places the projects in the root of the solution, rather than creating
66         a solution folder.  Available since .NET Core 3.0 SDK.
67
68       · -s|--solution-folder
69
70         The destination solution folder path to add the projects to.   Avail‐
71         able since .NET Core 3.0 SDK.
72
73   remove
74       Removes a project or multiple projects from the solution file.
75

SYNOPSIS

77              dotnet sln [<SOLUTION_FILE>] remove <PROJECT_PATH>
78              dotnet sln [<SOLUTION_FILE>] remove [-h|--help]
79
80   Arguments
81       · SOLUTION_FILE
82
83         The solution file to use.  If not specified, the command searches the
84         current directory for one.  If there are multiple solution  files  in
85         the directory, one must be specified.
86
87       · PROJECT_PATH
88
89         The path to the project to remove from the solution.  Remove multiple
90         projects  by  adding  one  after  the  other  separated  by   spaces.
91         Unix/Linux  shell globbing pattern expansions are processed correctly
92         by the dotnet sln command.
93

OPTIONS

95       · -h|--help
96
97         Prints out a short help for the command.
98
99   list
100       Lists all projects in a solution file.
101

SYNOPSIS

103              dotnet sln list [-h|--help]
104
105   Arguments
106       · SOLUTION_FILE
107
108         The solution file to use.  If not specified, the command searches the
109         current  directory  for one.  If there are multiple solution files in
110         the directory, one must be specified.
111

OPTIONS

113       · -h|--help
114
115         Prints out a short help for the command.
116

EXAMPLES

118       Add a C# project to a solution:
119
120              dotnet sln todo.sln add todo-app/todo-app.csproj
121
122       Remove a C# project from a solution:
123
124              dotnet sln todo.sln remove todo-app/todo-app.csproj
125
126       Add multiple C# projects to a solution:
127
128              dotnet sln todo.sln add todo-app/todo-app.csproj back-end/back-end.csproj
129
130       Remove multiple C# projects from a solution:
131
132              dotnet sln todo.sln remove todo-app/todo-app.csproj back-end/back-end.csproj
133
134       Add multiple C#  projects  to  a  solution  using  a  globbing  pattern
135       (Unix/Linux only):
136
137              dotnet sln todo.sln add **/*.csproj
138
139       Remove  multiple  C#  projects from a solution using a globbing pattern
140       (Unix/Linux only):
141
142              dotnet sln todo.sln remove **/*.csproj
143
144
145
146                                                         dotnet sln command(1)
Impressum