我如何检查文件是否存在,如果不存在,则终止版本? [英] How can I check if file exists, and if not kill the build?

查看:55
本文介绍了我如何检查文件是否存在,如果不存在,则终止版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何停止构建,并在文件不存在时通知用户?我知道如果文件存在,我可以使用可用的任务来设置属性,但是我不确定如何停止构建并回显某些内容.

How can I stop a build, and notify the user if a file does not exist? I know I can use the available task to set a property if a file exists, but I'm not sure how I would stop a build and echo something.

如果可能的话,我想坚持核心任务.

I would like to stick with core tasks if possible.

推荐答案

您可以使用失败任务来满足您所有失败的需求.该页面上的最后一个示例实际上就是您所需要的

You can use the fail task for all your failing needs. The last example on that page is actually pretty much what you need

<fail message="Files are missing.">
    <condition>
        <not>
            <resourcecount count="2">
                <fileset id="fs" dir="." includes="one.txt,two.txt"/>
            </resourcecount>
        </not>
    </condition>
</fail>

这篇关于我如何检查文件是否存在,如果不存在,则终止版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆