NCrunch will clean out directories in the following situations:
- When a project within the solution is changed (must be a .proj file, not just one of the code files in the project, and all workspaces related to this project will be removed and replaced as needed)
- When a project is removed from the solution
- When NCrunch is disabled/reset
- About 10 seconds after VS is shutdown (you'll notice a small NCrunch .exe running after shutdown to perform this action cleanly when it can be sure nothing is touching the files)
- After initialisation of VS - in the event that VS wasn't shut down correctly and derelict workspaces may be present
NCrunch will build workspaces as it needs them. Basically, when the engine needs to perform a task, it will check for an existing workspace that has been pre-created for the applicable project. If the workspace doesn't exist or all existing workspaces are in use (for example, if tests or builds are still running against them), then a new workspace is built. In this way, you'll notice that the number of workspaces will steadily increase over time until it reaches a maximum optimal level that is determined by your NCrunch configuration.
It is not safe to delete any workspaces while the engine is running, as each workspace is individually tracked and may be reused at any time.
If you're experiencing problems with disk space consumption, you can reduce the number of workspaces needed by NCrunch by adjusting the engine to perform less work concurrently. This can be done by adjusting the
Max number of processing threads and
Max test runners to pool configuration settings.