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

For Umbraco 17, in local development, it seems I cannot make changes to razor files without rebuilding the project every time (unless I’m missing something).

If I install the package Umbraco.Cms.DevelopmentMode.Backoffice, this should work, but I only want this functionality on localhost development environments.

Do I need to uninstall this package in production branches if I don’t want its functionality on production? If so, I really dislike this, as it means development branches will require this package to be worked on, and will differ from production branches. This means for every merge, we will have to remove the Umbraco.Cms.DevelopmentMode.Backoffice package. Maybe I’m missing something?

Perhaps there is a killswitch that could be set in appsettings.json so the Umbraco.Cms.DevelopmentMode.Backoffice package can remain but be disabled? Idk.

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'" />
2 Likes

I’m glad I asked. For some reason I assumed hot reload was automatic. Thanks for the detailed reply!

1 Like

Note, if anyone has trouble getting the Umbraco.Cms.DevelopmentMode.Backoffice package to work, you may need to set your appsettings.Development.json file to use BackofficeDevelopment mode:

"Umbraco": {
  "CMS": {
    "Runtime": {
      "Mode": "BackofficeDevelopment"
    }
...

After setting this, it worked for me.

I currently prefer the conditional package reference suggestion, in Debug mode only, as this seems faster for local development than hot reload:

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

Thanks!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.