使用msbuild扩展包验证文件夹是否存在? [英] verify the existence of a folder using the msbuild extension pack?

查看:84
本文介绍了使用msbuild扩展包验证文件夹是否存在?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用msbuild扩展包任务可靠地验证文件夹的存在?

How can I dependably verify the existence of a folder using an msbuild extension pack task?

我怎么做而又不会抛出错误并停止构建?

How could i do it without throwing an error and stopping the build?

推荐答案

您可以在目标上使用Exists条件吗?

Could you use the Exists condition on a target?

仅当在与msbuild文件相同的目录中有一个名为Testing的目录或文件时,这才会执行OnlyIfExists目标.

This will execute the OnlyIfExists target only if there is a directory or file called Testing in the same directory as the msbuild file.

<ItemGroup>
    <TestPath Include="Testing" />
</ItemGroup>
<Target Name="OnlyIfExists" Condition="Exists(@(TestPath))">
    <Message Text="This ran!" Importance="high" />
</Target>

这篇关于使用msbuild扩展包验证文件夹是否存在?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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