ENC1003 C# Changes made in project will not be applied while the application is running

Jez*_*Jez 7 c# warnings visual-studio asp.net-core visual-studio-2019

I am getting this incredibly annoying warning for every C# file in my ASP.NET Core project when I debug it after hitting F5:

警告截图

Because this error appears only during runtime (not during build), I can't even suppress it using the "Suppress warnings" box in the project properties. I've tried putting 1003 and ENC1003 in there and it still appears, cluttering up my warnings window. Does anyone know why this thing is appearing and how I can get rid of it?

UPDATE: It doesn't fix the fundamental problem which is that the warning is generated in the first place, but I've found a way to suppress it. Create a GlobalSuppressions.cs file at the project root, and add the line:

[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage(null, "ENC1003")]
Run Code Online (Sandbox Code Playgroud)

Related Github issue: https://github.com/aspnet/AspNetCore/issues/13284

Pat*_*ner 2

尝试获取最新版本的 Visual Studio,然后重试,如果仍然存在,请安装 Visual Studio 2019 v16.4 Preview 2。

另请查看以下内容>> https://developercommunity.visualstudio.com/content/problem/601258/edits-were-made-to-the-code-which-cannot-be-applie.html。您还可以在 ASP.NET Github 上跟踪同一问题: https: //github.com/aspnet/AspNetCore/issues/13284。我们已经修复了该问题,该修复将在 Visual Studio 16.4 Preview 2 上提供

我在 Visual Studio 2019 中遇到了同样的问题,因此我必须将 VS 更新到最新版本,这样就可以了。

希望对某人有帮助:) :)