title: Running grunt from MSBuild
body: <p>This thread (<a href="https://github.com/gruntjs/grunt/issues/117">Problem capturing error output</a>) gives you a taste of the problem I'm struggling with. I'm trying to run grunt from MSBuild and the grunt errors are not displayed in the Visual Studio output window.  I have a .NET project in Visual Studio Express 2012 for Web.  I have imported an external project into the project build file with the IMPORT tag and in the imported project I have an Exec task attempting to run grunt.  I obviously want to see the error messages that grunt outputs in my Visual Studio output window without too much fuss.
  I found an extremely simple workaround that at least sends the output to a text file. </p>
  
  <pre><code>grunt.cmd &gt; grunt-output.txt
  </code></pre>
  
  <p>This output file is in my .NET project folder somewhere so a quick refresh and double click allows me to open the output file and see a slightly garbled version of the grunt output in Visual Studio.</p>
  
  <p>As an example I'm running a lint task on the grunt.js file, which contains things which JSHint would object to. I deliberately didn't put a semi-colon after <code>var hello</code> and so you get the error message <code>Missing semicolon</code>. </p>
  
  <p>From the command line I get a nicely formatted error message. </p>
  
  <pre><code>Running "lint:files" (lint) task
  Linting grunt.js...ERROR
  [L2:C10] Missing semicolon.
  var hello
  
  &lt;WARN&gt; Task "lint:files" failed. Use --force to continue. &lt;/WARN&gt;
  
  Aborted due to warnings.
  </code></pre>
  
  <p>When I run it from Visual Studio, the output file contains this cluttered format:</p>
  
  <pre><code>    [4mRunning "lint:files" (lint) task[24m
       Linting grunt.js...[31mERROR[39m
       [31m[[39m[33mL2[39m[31m:[39m[33mC10[39m[31m][39m [33mMissing semicolon.[39m
       var hello[31m[7m [27m[39m
  
       [31m&lt;[39m[33mWARN[39m[31m&gt;[39m [33mTask "lint:files" failed. Use --force to continue.     [39m [31m&lt;/[39m[33mWARN[39m[31m&gt;[39m
  
       [31mAborted due to warnings.[39m
  </code></pre>
  
  <p>Does anyone recognise what all those square brackets and numbers are doing, and can anyone think of a command line switch or grunt switch or node.js switch that would interpret them and turn them into formatting?  The don't look like some kind of encoding, they look more like tags to suggest to the command line environment how to format the message. Please don't suggest running some kind of regular expression replace function. I want something quick and easy otherwise it would become more trouble than it's worth.</p>
  
  <p>UPDATE: this link <a href="https://github.com/visionmedia/mocha/issues/333">Output gets cut off if piped into another application</a> is pointing to a problem further upstream in node dating back 10 months. While that's getting sorted out it would be nice to at least get a more readable output file.</p>