Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why doesn't Razor automatically recompile after save when using .NET 6.0? [duplicate]

I was unhappy after moving to .NET 6 when I discovered that changes I made to the razor weren't being automatically compiled after clicking save. I spent months having to restart the whole web server every time I made a small change to the site I'm developing. I scoured the internet looking for a solution and even communicated with a Microsoft team member, all to no avail.

Luckily, my coworker stumbled into a solution that works perfectly and I wanted to share it with other people who are having the same issue.

like image 819
mattersonline Avatar asked Oct 22 '25 11:10

mattersonline


1 Answers

Just add this library to the project file and it'll start working.

<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="6.0.1" />
like image 151
mattersonline Avatar answered Oct 25 '25 08:10

mattersonline



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!