title: How to specify location where test results are saved to?
body: <p>When automating tests, I would use MSTest.exe, the command-line program. I would pass in a parameter which would specify the location where I want the test result file to save to.</p>
  
  <p>My problem is that I want to be able to run tests from the Visual Studio GUI, and still be able to specify a location for the test results file. </p>
  
  <p>My reason for this is that I am writing a bit of code to read the test result file (since it's in XML format) and to then email the results to a specified email address. </p>
  
  <p>I want my test to get the test result file from the same location regardless of whether I run the test via MSTest.exe or via the Visual Studio GUI. </p>
  
  <p>I know that I can do this in the GUI by selecting the 'Export Test Run Details' option from the 'Test Results' window. I want to know how to do this programmatically, so I can perform the action automatically once the test run has completed. </p>
  
  <p>... alternatively, aren't there classes that should allow me to access the test result information programmatically? I believe there is a TestResult class that might help me, for example, although I'm not quite sure how to use this. I also noticed that the TestContext class has properties such as 'DeploymentDirectory', but they are read-only.</p>
  
  <p>Also, I read elsewhere on-line that with VS2008, you can edit the .testrunconfig file to add the following line in the TestRunConfiguration element: </p>
  
  <blockquote>
    <p>'&lt;'Deployment userDeploymentRoot="C:\TestResults" useDefaultDeploymentRoot="false" /></p>
  </blockquote>
  
  <p>But the .testrunconfig file doesn't exist in my solution, and the TestRunConfiguration element doesn't appear in my .vsmdi file. </p>
  
  <p>Any help is appreciated, thanks. </p>