Solution 1:
Auto-rebuild functionality is now available for Blazor Projects in Visual Studio. To utilize this feature, run the project using the Ctrl + F5 shortcut (without the debugger) instead of F5 and on IIS Express. Whenever you modify and save .cs and .razor files within the solution, they will be automatically rebuilt, and the application will restart. This allows you to view the changes by simply refreshing the browser, eliminating the need for manual rebuilding and restarting the application.
Solution 2:
you can use the following command in the command prompt.
dotnet watch run debug |
Also, you must include the following file types in the .csproj file for which files you want to watch.
<ItemGroup>
<Watch Include="..\**\*.razor" />
<Watch Include="..\**\*.scss" />
<Watch Include="..\**\*.cs" />
</ItemGroup>
Refer to this Link for more information.
Share with