我想要写 <Message Text="Line1\nLine2\nLine3" />
但是 \n 似乎无法正常工作。我应该用什么替换 \n 呢?
(我在书中读到,打印 @ 和 % 的方法是使用 %40 和 %25,所以我猜应该也有一个数字来表示换行符)。
我想要写 <Message Text="Line1\nLine2\nLine3" />
但是 \n 似乎无法正常工作。我应该用什么替换 \n 呢?
(我在书中读到,打印 @ 和 % 的方法是使用 %40 和 %25,所以我猜应该也有一个数字来表示换行符)。
<Message Text="Line1%0aLine2%0aLine3%0a" />
CR = 0x0D 或者 13
LF = 0x0A 或者 10
<Message Text="$([MSBuild]::Escape('A\r\nB\r\nC\r\n'))" />
A\r\nB\r\nC\r\n
。Unescape()
也不起作用。 - Sebastian KrysmanskiMyMultilineMessage
),然后在消息文本中使用该属性。(至少适用于VisualStudio 2019的MSBuild) <PropertyGroup>
<MyMultilineMessage>
Lorum ipsum...
</MyMultilineMessage>
</PropertyGroup>
<Message Importance="High" Text="$(MyMultilineMessage)"/>
这对于Error
元素同样适用。
编辑:在缺少PropertyGroup
的评论后修改了上面的XML示例。
....
- Ste<ItemGroup>
<Lines Include="Line 1 " />
<Lines Include="Line 2 " />
<Lines Include="Line 3 " />
</ItemGroup>
<Message Text="%(Lines.Identity)"/>