I have just written开发者_StackOverflow a small utility to be used in a pre-build event. The utilty works fine when run as standalone, but does nothing when used in the build event. Is there a standard way of noticing and dealing with error conditions in build events, or is that the domain of more advanced build control?
AFAIK, Visual Studio detects build event results by the program return code. If program returns 0, build event succeeded. Generate appropriate return code in your utility, if something is wrong. Throwing exception from a Console application is also OK, unhandled exception details are printed in the build output, and build stops.
精彩评论