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

时间:2019-01-10 05:55:42

标签: .net msbuild csproj msbuild-task

例如,我的~/erlang_programs/mnesia$ rm -rf Mnesia.nonode\@nohost/ ~/erlang_programs/mnesia$ erl Erlang/OTP 20 [erts-9.3] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:10] [hipe] [kernel-poll:false] Eshell V9.3 (abort with ^G) 1> c(my). my.erl:2: Warning: export_all flag enabled - all functions will be exported {ok,my} 2> my:init(). {atomic,ok} 3> my:start_counter(people). {atomic,ok} 4> my:insert("Joe", 22). {atomic,ok} 5> my:insert("Sue", 31). {atomic,ok} 6> my:select_all(). [{person,1,"Joe",22},{person,2,"Sue",31}] 7> mnesia:stop(). stopped 8> =INFO REPORT==== 9-Jan-2019::23:30:02 === application: mnesia exited: stopped type: temporary (Hit Return to get back to prompt) 8> 中有以下一行:

csproj

此消息的问题很长,很难阅读代码,在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..." />

但是这种情况下的输出不可读,因为每一行都有关于<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 target文件名的冗余信息。

因此,我想要类似的东西:

csproj

1 个答案:

答案 0 :(得分:1)

将行放入ItemGroup中并将其连接在一起:

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