我正在使用 Microsoft Visual Studio Express 2012 的构建事件将一些文件复制到 $(TargetDir)
。如果找不到特定文件,我该如何停止构建。目前我有类似的东西:
IF EXIST somefile (
ECHO true
) ELSE (
ECHO false
)
根据需要在构建输出对话框中显示 true
和 false
但我想用
ECHO false
ELSE (
ECHO somefile was not found
exit
)
exit
停止 Visual Studio 构建项目,somefile was not found
是输出控制台中显示的最后一条消息。
最佳答案
强制 visual studio 停止它只需要设置错误级别的构建
IF NOT EXIST somefile (
echo somefile was not found
echo ERROR: This will be displayed in the error list of VS
exit /b 1
)
关于windows - 使用构建事件停止构建并显示消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19360054/