How to specify results directory with vstest.console

VSTest.console command line runner creates the results in the current directory of the command prompt by default but you can change and this post talks about how you can do that.

1. Create a run settings file specifying the results directory. For example the following content in runsettings file will create results in directory c:\temp.

<?xml version="1.0" encoding="UTF-8"?>
< RunSettings>
< RunConfiguration>
< ResultsDirectory>c:\temp</ResultsDirectory>
</RunConfiguration>
< /RunSettings>

2. Pass the above created run settings file as a command-line argument to vstest.console. This should create the results directory specified in the runsettings file.

vstest.console <Test container> /settings:customDirectory.runsettings

Enjoy !!