Ever felt like Razor Pages dev is a little… stiff?
Ever wanted that magical Angular/Vite instant-reload dev loop but without switching ecosystems or bloating your stack?
Well, curiosity got the better of me — and now I’m never going back. This is how I turned Visual Studio’s Razor Pages workflow into a lean, fast, hot-reloading machine using nothing but dotnet watch, a single config tweak, and some stubborn experimentation.
🎯 Why Bother?
Let’s be real:
- Waiting for Visual Studio to compile, launch IIS Express, open the browser, then hit your endpoint…
- Only to repeat that every time you touch a
.cshtmlfile or toggle a CSS class?
That’s slow. Clunky. Painful.
Hot reload exists, but the default tooling isn’t exactly smooth for Razor Pages.
So here’s what we wanted:
- ✅ No more clicking Run and waiting forever
- ✅ Just code, save, and see changes instantly
- ✅ Get true hot reload output in the terminal (you know the one: colored, clean, with Ctrl+R to restart)
- ✅ And most importantly, a single click in Visual Studio to launch all of it
🔥 The Final Result
Here’s the launch profile we ended up with:
"profiles": {
"https(hot reload)": {
"commandName": "Executable",
"executablePath": "C:\\Program Files\\dotnet\\dotnet.exe",
"workingDirectory": "$(ProjectDir)",
"commandLineArgs": "watch run --project \"$(ProjectPath)\" --urls https://localhost:7050",
"launchBrowser": false
}
}
📌 What This Does:
Launches dotnet watch run directly — no wrappers, no PowerShell, no zombie processes
Targets the current .csproj dynamically with $(ProjectPath)
Forces it to run on a consistent port (7050) so you can open your browser to it and even hit it from other devices
Stops cleanly when you hit the Stop button in Visual Studio
🛠 How to Set It Up
- Open your project’s
Properties/launchSettings.json - Add the following profile under
profiles:"https(hot reload)": { "commandName": "Executable", "executablePath": "C:\\Program Files\\dotnet\\dotnet.exe", "workingDirectory": "$(ProjectDir)", "commandLineArgs": "watch run --project \"$(ProjectPath)\" --urls https://localhost:7050", "launchBrowser": false } - Make sure the port
7050matches whatever you want — update it in both this line and your browser. - In Visual Studio, click the green dropdown next to the ▶️ button and choose
https(hot reload) - Hit ▶️ and marvel.
🧠 Why This Works
Visual Studio doesn’t natively support dotnet watch as a launch target. But by leveraging the Executable profile type and pointing directly to the dotnet CLI, we trick it into launching watch mode as if it were built-in.
Then, by using:
$(ProjectPath)— to dynamically get the active.csproj--urls— to force it to use a predictable port
We’ve created a smooth, hot-reloading experience with just one click, no extra terminals, and full control.
🧪 Pro Tips
Add a delay-based browser launch if you want to auto-open the page (or do it manually — no big deal).
Match the port (7050) to your needs. Want 5001? Change it. Just make sure it’s not already in use.
Works best with .NET 6+ (we’re using .NET 8)
😎 Why I Did It
Honestly? Curiosity.
I just wanted Razor Pages to feel modern. I didn’t want to switch to Blazor, Angular, or React for something that should be fast by default. And once I saw how good dotnet watch’s hot reload output was, I had to find a way to wire it into my workflow.
Now I’m spending less time waiting, more time building, and I can’t imagine going back.
✅ TL;DR
Add "https(hot reload)" profile to your launchSettings.json
Use dotnet.exe directly with watch run
Enjoy Angular-level speed in your Razor Pages world
Thank your future self for having one of the slickest setups around

























