Cleaning the workspace
Occasionally, it's necessary to clean a workspace of any generated, intermediate and temporary files.
For example,
- The local build is misbehaving or flaky
- Local tools are getting confused by outdated artifacts
- CI/CD will want to start from a known state
For this, there is a standard dotnet
command that clears all output and intermediate folders. This command does not clear the .vs
caching folder.
dotnet clean
If you want to clean out everything that hasn't been committed, you can use git
instead:
git clean -x -d -f -f
This will clear out all files (and folders, including empty ones) that do not belong to the workspace.