Search code examples
c#visual-studioasp.net-core-mvc

Visual studio showing build failed even for the newly created ASP.NET Core MVC project


When I installed Visual Studio with .NET and created a new project (ASP.NET Core MVC web app), it was working fine & showing proper output when I clicked on the build project.

But after 2 days, I created another new project of same ASP.NET Core MVC web app template, and trying to build it without any changes, I get a "build failed", but there is no error mentioned in the error list.

Also when I'm trying to install any NuGet package, it's not installing them. After clicking on the install button, it comes back to the same 'click to install' state after 2/3 seconds. Here are a few screenshots below:

enter image description here

On the above screenshot you can see it's a basic project structure with No changes. It should build the solution without any failure. Also, there is no reason for failure.

enter image description here

Above is the screenshot of nuget package installation issue. This screenshot is taken after clicking on the install button and accepting the license.

Please let me know if you need any other information. I have tried uninstalling the Visual studio, it fixed the issue for a few days but after 2/3 days it starts happening again which is very frustrating.

Thanks, in advance.


Solution

  • Sometimes a few antiviruses like Protegent AV automatically delete important Visual studio installation files and due to which this issue may occur, it happened in my case. So, in that case remove the visual studio completely from your machine and reinstall it and then whenever you scan your PC tell Protegent not to delete visual studio file or during the cleaning process ignore visual studio files. Thanks.