Getting JSLint to break a build in visual studio 2010
I have integrated JSLint (http://javascriptlint.com) into my projects post build - but can't seem to get it to fail the build if an error/warning occurs?
Currently JSLint is ran from a .bat file that gets executed on post-build
开发者_开发百科Is there a param I can pass in to tell JSLint to fail the build if error/warning is encountered?
Thanks in advance folks
The JSLint extension for VS2010 has an option to automatically display JSLint warnings in the error list. In addition, you can run JSLint on build and cancel the build if a rule is violated.
Or, if you would like to continue running JSLint through a batch script, you could force MSBuild to raise an error depending on the return exit code of the script:
<Target Name="AfterBuild">
<Exec Command="jslint.bat" ContinueOnError="true">
<Output TaskParameter="ExitCode" PropertyName="ErrorCode" />
</Exec>
<Error Text="Error running JSLint" Condition="'$(ErrorCode)'>'0'" />
</Target>
精彩评论