Hi @Jacaru Tech ,
From your description, it seems that you are using VS2022 to create an Asp.net core Web application (a Razor page application), then use the .NET CLI command to run the application, right? If that is the case, it will not trigger the debugger, and after modifying the code, you have to re-build the application and run the application, then the updated content will work. It is because that you are directly running the application's exe file.
You have to use the Visual Studio 2022 debugger to debug the code. If you want to use the .Net CLI commands, you might need to use Visual Studio code, refer Tutorial: Debug a .NET console application using Visual Studio Code. In my opinion, I prefer to use VS 2022 debugger.
You can refer the following steps to create a asp.net core web application and debug it using Visual Studio 2022.
- Create a new Asp.net core Web App.
- In Solution Explorer, open Index.cshtml.cs (under Pages/Index.cshtml) and add a break point.
- Then, select the Debug mode, and run the application on IIS express.
The result as below:
More detail information about debug, see What is debugging? and Quickstart: Debug ASP.NET Core with the Visual Studio debugger.
Besides, in VS 2022, there is a new feature about .NET Hot Reload, with Hot Reload you can now modify your apps managed source code while the application is running, without the need to manually pause or hit a breakpoint. You can also refer the above .gif image to see the result.
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Best regards,
Dillion