V17 Deploy Clears .cshtml Contents and Updates .uda Files

Running v17 on Cloud I notice that Deploy (I assume it’s Deploy) is periodically clearing the contents of the .cshtml files in /Views/ and then updating the corresponding .uda files by removing the reference to the Master template. The files are still on disk but now with no contents.

These liines are removed from the .uda files:
"Master": "umb://template/a3b18811c4304b678930a90054db0978",

These updates are comitted with a commit message like

commit 3d5597844e1efe6c4847111bc08700dccab17c22 (origin/master, origin/HEAD)
Author: Umbraco Cloud <[email protected]>
Date:   Fri Dec 5 18:32:03 2025 +0000

Adding  template 'Blog Categories' along with 23 other items

I have removed these lines from the .csproj files already

<RazorCompileOnBuild>false</RazorCompileOnBuild>
<RazorCompileOnPublish>false</RazorCompileOnPublish>

What else could be causing this? I only notice this on the Cloud Environments, not in my local dev instance. It is a bit concerning that Deploy is actually deleting file contents.

The Cloud support folks have responded to this topic with a very helpful explanation. I’ll add it here in case this helps other.

​On Umbraco Cloud, Deploy treats Templates as managed artifacts (via the .uda files). If Deploy detects that a template’s artifact does not contain Razor markup or a valid Master reference, it will normalize the state by:

  • Removing the Master reference from the .uda file, and
  • Overwriting the matching .cshtml file with what it believes is the canonical state — which results in an empty file.

This is why:

  • The commits come from Umbraco Cloud
  • You only see this behavior on Cloud, not locally
  • The Razor compile flags in the .csproj do not prevent it

At the moment, your project appears to be in a mixed state where templates are managed both via files and via Deploy, which leads to Deploy repeatedly overwriting your .cshtml files.

Next recommended steps:

  • Restore the affected .cshtml files from Git or local backup.
  • Decide on a single source of truth for templates (either fully file-based or fully Deploy-managed).
  • Once aligned, Deploy will stop clearing the files.

In my case, I want to manage templates as .cshtml files and deplopy using git, so I removed the template*.uda files in order to indicate to Deploy to not manage the templates. This is the Default way that Deploy works unless it detects template*.uda files in which case Deploy will manage templates - potentially overwriting any .cshtml files on disk.

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