MSBuild 错误任务在 VS 中显示为警告
我在 C# MSBuild 项目中有一个错误任务。该错误在 VS2022 中显示为警告,位于由错误任务停止构建直接导致的大量其他错误下方。我希望其他错误根本不显示,但如果做不到这一点,错误任务错误至少应该位于列表的顶部,并且当然不仅仅是警告。我该如何解决这个问题?
错误任务如下所示:
<Target Name="ShowError">
<Error Text="ToErrIsHuman" Code="CS0518"/>
</Target>
项目有 InitialTargets="ShowError"
来触发错误任务。 Code
属性似乎没有任何效果。
I have an Error task in a C# MSBuild project. The error shows up as a warning in VS2022, below a huge number of other errors that are directly caused by the Error task halting the build. I'd prefer that the other errors don't show up at all, but failing that, the Error task error should at least be on the top of the list and certainly not a mere warning. How can I fix this?
The Error task looks like this:
<Target Name="ShowError">
<Error Text="ToErrIsHuman" Code="CS0518"/>
</Target>
The Project has InitialTargets="ShowError"
to trigger the Error task. The Code
attribute does not seem to have any effect.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
4.x .NET Framework 项目中出现错误。重新启动 Visual Studio 即可修复。
Error shows up in 4.x .NET Framework projects. Restart Visual Studio to fix.