【发布时间】:2020-06-22 15:30:04
【问题描述】:
所以我有一个 .target 文件,它通过另一个 .target 文件解析以获取构建配置信息。它试图检索的标记示例是:
<bldConfiguration>Debug|x64; Release|x64</bldConfiguration>
执行检索的代码是:
<ItemGroup>
<tempMap Include="$(bldConfiguration)"/>
<Configs Include="@(tempMap)">
<Configuration>$([System.String]::new('%(tempMap.Identity)').split("|")[0])</Configuration>
<Platform>$([System.String]::new('%(tempMap.Identity)').split("|")[1])</Platform>
</Configs>
</tempMap>
</ItemGroup>
我在 Platform 属性上收到错误消息,指出索引超出范围。基于 ('%(tempMap.Identity)') 正在拆分的字符串是 Debug|x64 和 Release|x64 所以理论上它不应该超出范围。如果您看到我的错误,请随时纠正我。
当我尝试输出 Configuration 中包含的属性时,我可以看到值是什么:
<Message Text="$([System.String]::new('%(tempMap.Identity)').split("|")[0])">
我收到一条错误消息,提示“无法识别元素中的属性文本。”
如何将 or 属性“打印”到控制台或登录 MSBuild 以便查看结果?我很难调试这些标记 .target 文件。
谢谢!
【问题讨论】:
标签: debugging split msbuild output target