开发者

How can I have a pre-build event halt the build if something went wrong with it (VS 2010/C#)?

I'm executing a simple console exe program in a pre build event that consolidates a bunch of xml files into one big xml file. This will vastly cut down on spin-up time when the program is run.

Is there a special return code I can use that will inform VS-2010 that something went wrong with the pre-build event and will cause the build to halt?

开发者_运维知识库

Is there some other solution to this?

Thanks,

Isaac


Build events normally abort when one of their commands fail. If you have to such condition then you can create one with the exit /b command. Like this:

if exist "foo.bar" goto good
exit /b 42
:good

The exit code is fairly arbitrary, anything other than 0 causes a build abort.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜