Fail on Post-Build event?

白昼怎懂夜的黑 提交于 2019-12-11 07:44:56

问题


Is there a way to force the build to fail given certain conditions in the post-build event? The package I'm working with runs jslint and a few other solutions all together on post-build, I would like Visual Studio to fail if jslint produces an error.

I am aware of the jslint plugin for VS2010 that will fail the build on error, but my requirements are restricting me to using the packaged bugchecking solution in which jslint is contained.


回答1:


Post build events are basically batch scripts - you can check for error return values using "if ERRORLEVEL".

Example of a failing copy command:

copy "$(ProjectDir)myfile.ext" "$(TargetDir)"
if ERRORLEVEL 1 goto EXIT

:EXIT



回答2:


I believe there is an attribute called continueonerror and breakonerror etc that can be added to these post build events. Can you take a look at the same.. I hv this implemented but right nw no access to my machine will get back to you if this doesn't solve your problem or if smbody else can't..



来源:https://stackoverflow.com/questions/7151484/fail-on-post-build-event

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!