MSBuild -> (arrow/dash greater/->) 运算符有什么作用?

What does the MSBuild -> (arrow/dash greater/->) operator do?

->(或->)运算符在 MSBuild 中做什么?

来自另一个问题的一些示例代码:File Tracker Log file format

<!-- Appended tlog to track custom build events -->
<WriteLinesToFile
  File="$(IntDir)$(ProjectName).write.1.tlog"
  Lines="@(CustomBuildStep-&gt;'^%(Identity)');@(CustomBuildStep-&gt;MetaData('Outputs')-&gt;FullPath()-&gt;Distinct())"/>

奖金问题@(CustomBuildStep-&gt;'^%(Identity)')在上面的代码中做了什么?

MSBuild 中的 -> 运算符是 transformation operator。它通过使用原始项目的元数据替换右侧的字符串,将项目列表转换为新的项目列表。

->'^%(Identity)' 魔法在 task batching 文档中有部分描述。 Identity 元数据只是值本身,因此转换只是在“^”前面加上。由于 % 印记,它还会导致批处理,因此整个 WriteLinesToFile 任务会针对每个 CustomBuildStep 项目执行。