Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

Warning screenshot

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")]

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

like image 469
Jez Avatar asked Aug 20 '19 14:08

Jez


2 Answers

Try to get the Lastest Version of your Visual Studio and try again, If Persist, Install Visual Studio 2019 v16.4 Preview 2.

Also Check out the following content>> https://developercommunity.visualstudio.com/content/problem/601258/edits-were-made-to-the-code-which-cannot-be-applie.html. You can also track this same issue on ASP.NET Github: https://github.com/aspnet/AspNetCore/issues/13284. We already have a fix for it, which will be available on Visual Studio 16.4 Preview 2

I was facing the same problem in my Visual Studio 2019, and therefore I had to update VS to the latest version and I was good to go.

Hope helps someone :) :)

like image 112
PatsonLeaner Avatar answered Sep 30 '22 00:09

PatsonLeaner


You can go to build options and select the option to build solution (build->build solution), this should solve the problem and you will able to continue your project in solution mode.

like image 27
Milan Avatar answered Sep 29 '22 22:09

Milan