如何在 csproj 文件中包装 MSBuild 错误任务的长文本

How to wrap long text of MSBuild error task in csproj file

例如,我的 csproj 中有以下行:

<Error Text="Here is my very very long description of the exception that should explain how to fix it, make life better and give an answer to the meaning of life..." />

这个问题这个消息很长,很难阅读代码,在 GitHub 等中复习

我尝试了以下方法:

<Error Text="Here is my very very long description of the exception
    that should explain how to fix it, make life better
    and give an answer to the meaning of life..." />

但是这种情况下的输出不可读,因为每一行都有关于 build targetcsproj 文件名的冗余信息。

因此我想要这样的东西:

<Error Text="Here is my very very long description of the exception" +
    "that should explain how to fix it, make life better" +
    "and give an answer to the meaning of life..." />

将行放入项目组并将它们连接在一起:

<Target Name="LongError">
  <ItemGroup>
    <Lines Include="abc"/>
    <Lines Include="def"/>
  </ItemGroup>
  <Error Text="@(Lines, ' ')" />
</Target>