.NET Core Global Tool for cleaning up solution, project or folder.
The tool will list the files and folders which will be deleted,
and you will be prompted to confirm. Can be disabled with
Deleted files and folders are first moved to a temporary folder before deletion, so you can continue working with your projects, while the tool keeps cleaning up in background.
dotnet tool install -g dotnet-cleanup
Usage: cleanup [arguments] [options] Arguments: PATH Path to the solution-file, project-file or folder to clean. Defaults to current working directory. Options: -p|--paths Defines the paths to clean. Defaults to 'bin', 'obj' and 'node_modules'. -y|--confirm-cleanup Confirm prompt for file cleanup automatically. -nd|--no-delete Defines if files should be deleted, after confirmation. -nm|--no-move Defines if files should be moved before deletion, after confirmation. -t|--temp-path Directory in which the deleted items should be moved to before being cleaned up. Defaults to system Temp-folder. -v|--verbosity Sets the verbosity level of the command. Allowed levels are Minimal, Normal, Detailed and Debug. -?|-h|--help Show help information
PATH can point to a specific
a project-file (
.sln-file is specified, all its projects will be cleaned.
If it points to a folder, the folder will be scanned for a single solution-file and then for a single project-file. If multiple files are detected an error will be shown and you need to specify the file.
If not solution or project is found, the folder will be cleaned as a project.
To cleanup a typical web-project, you can specify the paths to be cleaned in the projects like this:
cleanup -p "bin" -p "obj" -p "artifacts" -p "npm_modules"