Search code examples
c#.netasp.net-core

ASP.NET Core with VS Code, can't run the application without debugging enabled


I'm stuck at the beginning of the ASP.NET Core tutorial with VS Code : https://learn.microsoft.com/en-us/aspnet/core/tutorials/first-mvc-app/start-mvc?view=aspnetcore-8.0&tabs=visual-studio-code

I'm at the step where we ask me to run the application. It works fine. But just after, it says :

  • Make code changes.
  • Save the file.
  • Quickly refresh the browser and see the code changes.

It does not work for me. I do launch without the debugger, with Ctrl+F5, or by going to "Run > Run WithoutDebugging". And if I make a code change (just changing some text) and refresh my browser, I don't see the change.

What could I have done wrong?


Solution

  • I have followed the same steps and able to reproduce the issue. I have noticed that in the VS we have the extension which is called "Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" and by using that and VS also provide hot reload option by using that you can see the changes in the browser without restarting the project.

    In VS code you can open the terminal and run command "dotnet watch run" which will provide you similar functionality.