How to disable TestResults folder in Visual Studio?
Solution 1:
I didn't find a way how to disable it completely but at least an acceptable workaround. It moves them to a location that is more appropriate for them. It goes like that:
-
Create a
.runsettings
file in your solution directory (you can give it any name - just keep the extension unchanged) with the following contents which will place theTestResults
directory in the%temp%
location of your machine. If you're not sure where it is, you can always check it in the command-line by callingecho %test%
or just pick any other location.<?xml version="1.0" encoding="utf-8"?> <RunSettings> <RunConfiguration> <ResultsDirectory>%temp%\TestResults</ResultsDirectory> </RunConfiguration> </RunSettings>
-
You now have to inform your test runner about it.
- for MSTest users: go to
Test > Test Settings > Select Test Settings File
- for ReSharper users: go to
ReSharper > Options > Tools > Unit Testing > Ms Test
and pick theUse specific test settings file
.
- for MSTest users: go to
btw, these folders are created always and just won't be deleted if you interrupt the test-runner so it won't clean them up.
(Inspired by Configure unit tests by using a .runsettings file)