Hot Reload with VSCode and Razor Pages in .NET6
VS2022 was causing huge performance issues (it was the razor pages editor see reddit) on a internal corp VM with big issues. So I switched to VS Code. I love Resharper so that’s the reason I’ve resisted VSCode for .NET.
Using a .NET6 Razor Pages project and VS Code
I found the easiest way to run Hot Reload was to not use Ctrl-F5, but to launch a terminal
# go into the Razor Pages Web project folder (usually 1 below solution level) cd WebApp dotnet watch # trying to only see the errors and not warnings # can't yet do with dotnet watch # this seems to work for build, but haven't figured out dotnet watch yet dotnet build /clp:ErrorsOnly
Also I turn off autosave - File menu
Had to use powershell as terminal disabled on the corp machine.
ASPNETCORE_ENVIRONMENT variable wasn’t set in powershell, so I’m defaulting to dev environment if none set.
Hot reload is a super useful feature!