更新时间:2022-11-19 12:56:25
没有内置的条件或函数可以根据文件的存在或不存在进行操作.
您可以编写并运行设置变量的脚本,然后检查变量的内容.
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.
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:
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.