1(1) .NET (1)
2
3
4
6 This article applies to: ✔️ .NET Core 2.x SDK and later versions
7
9 dotnet clean - Cleans the output of a project.
10
12 dotnet clean [<PROJECT>|<SOLUTION>] [-c|--configuration <CONFIGURATION>]
13 [-f|--framework <FRAMEWORK>] [--interactive]
14 [--nologo] [-o|--output <OUTPUT_DIRECTORY>]
15 [-r|--runtime <RUNTIME_IDENTIFIER>] [-v|--verbosity <LEVEL>]
16
17 dotnet clean -h|--help
18
20 The dotnet clean command cleans the output of the previous build. It’s
21 implemented as an MSBuild target, so the project is evaluated when the
22 command is run. Only the outputs created during the build are cleaned.
23 Both intermediate (obj) and final output (bin) folders are cleaned.
24
25 Arguments
26 PROJECT | SOLUTION
27
28 The MSBuild project or solution to clean. If a project or solution
29 file is not specified, MSBuild searches the current working directory
30 for a file that has a file extension that ends in proj or sln, and uses
31 that file.
32
34 • -c|--configuration <CONFIGURATION>
35
36 Defines the build configuration. The default for most projects is
37 Debug, but you can override the build configuration settings in your
38 project. This option is only required when cleaning if you specified
39 it during build time.
40
41 • -f|--framework <FRAMEWORK>
42
43 The framework that was specified at build time. The framework must
44 be defined in the project file. If you specified the framework at
45 build time, you must specify the framework when cleaning.
46
47 • -?|-h|--help
48
49 Prints out a description of how to use the command.
50
51 • --interactive
52
53 Allows the command to stop and wait for user input or action. For
54 example, to complete authentication. Available since .NET Core 3.0
55 SDK.
56
57 • --nologo
58
59 Doesn’t display the startup banner or the copyright message. Avail‐
60 able since .NET Core 3.0 SDK.
61
62 • -o|--output <OUTPUT_DIRECTORY>
63
64 The directory that contains the build artifacts to clean. Specify
65 the -f|--framework <FRAMEWORK> switch with the output directory
66 switch if you specified the framework when the project was built.
67
68 • -r|--runtime <RUNTIME_IDENTIFIER>
69
70 Cleans the output folder of the specified runtime. This is used when
71 a self-contained deployment was created.
72
73 • -v|--verbosity <LEVEL>
74
75 Sets the verbosity level of the command. Allowed values are q[uiet],
76 m[inimal], n[ormal], d[etailed], and diag[nostic]. The default is
77 normal. For more information, see <xref:Microsoft.Build.Frame‐
78 work.LoggerVerbosity>.
79
81 • Clean a default build of the project:
82
83 dotnet clean
84
85 • Clean a project built using the Release configuration:
86
87 dotnet clean --configuration Release
88
89
90
91 (1)