title: How to use MS code coverage tool in command line?
body: <p>I have the following C++ code.</p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  int testfunction(int input)
  {
      if (input &gt; 0) {
          return 1;
      }
      else {
          return 0;
      }
  }
  
  int main()
  {
      testfunction(-1);
      testfunction(1);
  }
  </code></pre>
  
  <p>I compiled it to get the execution</p>
  
  <pre><code>cl /Zi hello.cpp -link /Profile
  </code></pre>
  
  <p>Then, I instrument the execution and generated the .coverage binary.</p>
  
  <pre><code>vsinstr -coverage hello.exe
  start vsperfmon -coverage -output:mytestrun.coverage
  vsperfcmd -shutdown
  </code></pre>
  
  <p>When I open the coverage file in VS2010, I got nothing in its results.</p>
  
  <p><img src="https://i.stack.imgur.com/TpJ1Y.jpg" alt="enter image description here"></p>
  
  <p>What might be wrong?
  I followed the instructions in <a href="http://blogs.msdn.com/b/ms_joc/archive/2005/04/08/406608.aspx" rel="nofollow noreferrer">this post</a>. </p>