title: VS2013 CodeCoverage.exe runsettings file never parses
body: <p><strong>Environment:</strong> Visual Studio 2013 Premium, Win7Ultimate, CodeCoverage.exe</p>
  
  <p><strong>Goal:</strong> Code Coverage Report that excludes test project code to later be converted to a .coveragexml for reporting to SonarQube 5.1.</p>
  
  <p><strong>Annoyance</strong> I wouldn't even know of this parse error without adding the <code>/verbose</code> switch to the command.  My only indication of a failure was the .coverage file was no longer being generated when I added the <code>/config</code> switch.  </p>
  
  <p><strong>File Works in VS2013 IDE:</strong> MyProject.runsettings file provides the expected output using "Analyze Code Coverage" in the IDE.</p>
  
  <pre><code>Menu: Test | Test Settings | Select Test Settings File... MyProject.runsettings
  
  Menu: Test | Analyze Code Coverage | All Tests
  </code></pre>
  
  <p>Attempting to run the <code>CodeCoverage.exe</code> file to generate code coverage for my tests I can't seem to use ANY <code>*.runsettings</code> files without getting an error: </p>
  
  <pre><code>"Error: Failed to parse configuration file &lt;configfile&gt;.runsettings"
  </code></pre>
  
  <p>Path Definitions:</p>
  
  <pre><code>codeCoveragePath = C:\Program Files (x86)\Microsoft Visual Studio 12.0\Team Tools\Dynamic Code Coverage Tools
  
  vstestpath = C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow
  
  myProjectOutputPath = assume correct since I get results when not using /config switch
  </code></pre>
  
  <p>Run Command receiving Error (assume paths are correct): 
  <strong>Note:</strong> I'm not showing with <code>/verbose</code> switch since I shouldn't be using it under working conditions</p>
  
  <pre><code>%codeCoveragePath%\CodeCoverage.exe collect /config:MyProject.runsettings /output:CoverageOutput.coverage %vstestpath%\vstest.console.exe %myProjectOutputPath%\MyClass.Tests.Unit.dll
  </code></pre>
  
  <p><strong>Exe Works if I DON'T use the <code>/config</code> option</strong> If I remove the <code>/config:MyProject.runsettings</code> from the run command, I get a full report that includes the test project, but that let's me know the rest of the command is correct, it just doesn't like the runsettings file. </p>
  
  <p>I've tried using the following examples: </p>
  
  <p><a href="https://visualstudiogallery.msdn.microsoft.com/704ebd18-7d60-4341-9224-532f73229c74" rel="nofollow">Visual Studio 2013 runsettings Template file WITHOUT modification</a></p>
  
  <p><a href="https://msdn.microsoft.com/en-us/library/jj159530.aspx" rel="nofollow">MSDN's sample file</a></p>
  
  <p>Completed blank file, no content: error</p>
  
  <p>File with only the xml declaration: error</p>
  
  <p>File with only RunSettings Node declared: error</p>
  
  <p>I've even used the Troubleshooting tips from MSDN, too: no help.</p>
  
  <p>MyProject.runsettings file: </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RunSettings&gt;
    &lt;DataCollectionRunSettings&gt;
      &lt;DataCollectors&gt;
        &lt;DataCollector friendlyName="Code Coverage" uri="datacollector://Microsoft/CodeCoverage/2.0" assemblyQualifiedName="Microsoft.VisualStudio.Coverage.DynamicCoverageDataCollector, Microsoft.VisualStudio.TraceCollector, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"&gt;
          &lt;Configuration&gt;
            &lt;CodeCoverage&gt;
              &lt;ModulePaths&gt;
                &lt;Exclude&gt;
                  &lt;ModulePath&gt;.*\.Tests\.Unit\.dll$&lt;/ModulePath&gt;
                &lt;/Exclude&gt;
              &lt;/ModulePaths&gt;
            &lt;/CodeCoverage&gt;
          &lt;/Configuration&gt;
        &lt;/DataCollector&gt;
      &lt;/DataCollectors&gt;
    &lt;/DataCollectionRunSettings&gt;
  &lt;/RunSettings&gt;
  </code></pre>
  
  <p>The file seems to be correct based on the fact that the IDE will use it and generate the correct output in the "Code Coverage Results" window by only reporting the MyClass code and not any MyClass.Tests.Unit code.</p>
  
  <p>I'm at the point that I think it is the CodeCoverage.exe command line doesn't like the /config option or it is using a different xml schema.  </p>
  
  <p><strong>Update</strong></p>
  
  <p><strong>Works</strong> gives the output I want, just can't specify file location for next step</p>
  
  <pre><code>%vstestpath%\vstest.console.exe /Settings:MySettings.runsettings %myProjectOutputPath%\MyClass.Tests.Unit.dll
  </code></pre>
  
  <p><strong>Doesn't Work</strong> Gives exact opposite output I want (only test.dll coverage in the report).</p>
  
  <pre><code>%codeCoveragePath%\CodeCoverage.exe collect /output:CoverageOutput.coverage %vstestpath%\vstest.console.exe /Settings:MySettings.runsettings %myProjectOutputPath%\MyClass.Tests.Unit.dll
  </code></pre>
  
  <p>Still looking for an answer.</p>