У меня довольно длинное условие, которое используется в нескольких последующих задачах сборки, и все они выполняются, когда условие выполняется, а не когда оно ложно, например:
<!-- In the middle of a Target -->
<Copy Condition="'$(MyProperty1)' == 'true' and '$(AnotherProperty)' == 'false' and '@(YetAnotherProperty)' != ''" ... />
<Exec Condition="'$(MyProperty1)' == 'true' and '$(AnotherProperty)' == 'false' and '@(YetAnotherProperty)' != ''" ... />
<CustomTask Condition="'$(MyProperty1)' == 'true' and '$(AnotherProperty)' == 'false' and '@(YetAnotherProperty)' != ''" ... />
Это довольно раздражаетпопробовать и прочитать.Можно ли как-то «сохранить» это условие в какой-либо переменной или свойстве?Как:
MyVariable = "'$(MyProperty1)' == 'true' and '$(AnotherProperty)' == 'false' and '@(YetAnotherProperty)' != ''"
<Copy Condition="MyVariable" ... />
<Exec Condition="MyVariable" ... />
<CustomTask Condition="MyVariable" ... />
Я нашел элемент «Выбрать», но он не разрешен в Target, поэтому он не работает.