MSBuild 错误任务在 VS 中显示为警告

发布于 2025-01-10 15:14:06 字数 549 浏览 4 评论 0原文

我在 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?

enter image description here

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

诗化ㄋ丶相逢 2025-01-17 15:14:06

4.x .NET Framework 项目中出现错误。重新启动 Visual Studio 即可修复。

Error shows up in 4.x .NET Framework projects. Restart Visual Studio to fix.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文