Development Process in Umbraco 17 (Razor views and Umbraco.Cms.DevelopmentMode.Backoffice)

You have a few options here.

If you don’t want to take a dependency on Umbraco.Cms.DevelopmentMode.Backoffice at all then:

If you’re using Visual Studio, you can use Hot Reload, if you check “Hot Reload on File Save” you’ll get the behaviour you’re expecting.

Also you can use dotnet watch

Then when a file changes:

Finally, if you want to stick with Umbraco.Cms.DevelopmentMode.Backoffice you can load it conditionally, e.g.

<PackageReference Include="Umbraco.Cms.DevelopmentMode.Backoffice" Version="17.1.0" Condition="'$(Configuration)' == 'Debug'" />