任务自定义条件:给定的文件是否存在? [英] Task custom condition: does a given file exist?
问题描述
我想做什么
我有一个任务要执行,只有在某个配置文件存在时才有意义.因此,如果该文件存在,我想在返回 true
的任务上放置一个自定义条件.我想这样的语法是有意义的:
condition: exists('$(projectPath)myconfigfile.xml')
这似乎是自定义条件的合理用例.
微软的文档
我的实际问题
我觉得这有点令人沮丧.什么其他功能"?在那里?我该如何研究它们?特别是,是否有一个文件名并告诉我该文件是否存在?
没有内置的条件或函数可以根据文件的存在或不存在进行操作.
您可以编写并运行设置变量的脚本,然后检查变量的内容.
What I'm trying to do
I have a task to execute that only makes sense if a certain config file exists. So I want to put a custom condition on the task that returns true
if that file exists. I imagine a syntax like this would make sense:
condition: exists('$(projectPath)myconfigfile.xml')
This seems like a reasonable use case for custom conditions.
What Microsoft documents
Microsoft says the following functions are always available: and
, coalesce
, contains
, endsWith
, eq
, format
, ge
, gt
, in
, le
, lt
, ne
, not
, notIn
, or
, startsWith
, xor
. And furthermore:
My actual question
I'm finding this a little frustrating. What "other functions" are there? How can I research them? And in particular, is there one that takes a filename and tells me if that file exists?
There is no built in condition or function that operates off of the presence or absence of a file.
You can write and run a script that sets a variable, then check the contents of the variable.
这篇关于任务自定义条件:给定的文件是否存在?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!