如何阻止 C# 编译器输出包装在 Visual Studio 2015 输出窗口中?

如何阻止 C# 编译器输出包装在 Visual Studio 2015 输出窗口中?

问题描述:

当我使用默认编译器在 Visual Studio 2015 中构建我的 C# 代码时(该项目没有什么异常),我在输出窗口中得到输出,看起来有点像这样.(实际宽度不具代表性,因为我已经用 XXX 替换了相当长的路径.)

When I build my C# code in Visual Studio 2015 using the default compiler (nothing unusual about the project), I get output in the output window that looks a bit like this. (The actual width isn't representative, as I've replaced the rather long path with XXX.)

1>XXX(402,13,402,16): 错误 CS1955: 不可调用成员 'Lo1>g'不能像方法一样使用.1>XXX(424,25,424,28): 错误 CS1955: 不可调用成员 'Lo1>g'不能像方法一样使用.

大概编译器正在打印不可调用成员'Log'不能像方法一样使用,并且某处正在介入并弹出换行符(实际上在第120列 - 如上所述,我的示例输出中的列数不具代表性).

Presumably the compiler is printing Non-invocable member 'Log' cannot be used like a method, and something, somewhere, is stepping in and popping newlines in (at column 120 in practice - as mentioned, column counts in my example output are unrepresentative).

我能阻止吗?如果是这样,如何?

Can I stop this? If so, how?

我更喜欢在自然位置用换行符打印消息,这样我就可以使用输出窗口的自动换行功能.

I'd much prefer the messages to be printed out with newlines in natural places, so I can use the output window's word wrap functionality.

打开包管理器控制台后,构建输出开始如上所示.

After you open the Package Manager Console, build output starts to become wrapped as above.

修复似乎是重新启动 Visual Studio.

The fix appears to be to restart Visual Studio.