【问题标题】:What does the MSBuild -> (arrow/dash greater/->) operator do?MSBuild ->(箭头/破折号更大/->)运算符有什么作用?
【发布时间】:2015-12-12 14:31:34
【问题描述】:

->(或->)运算符在 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-&amp;gt;'^%(Identity)') 在上述代码中做了什么?

【问题讨论】:

    标签: visual-studio msbuild


    【解决方案1】:

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

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

    【讨论】:

    猜你喜欢
    • 2013-02-15
    • 1970-01-01
    • 2015-10-05
    • 1970-01-01
    • 1970-01-01
    • 2021-11-28
    • 2010-09-14
    • 2011-01-24
    相关资源
    最近更新 更多