U4-6946 - Existing template file on disk gets overwritten when you create a new doctype or new template in the backoffice

Created by Shannon Deminick 11 Aug 2015, 08:07:01 Updated by xiaohui zhao 13 Jul 2018, 09:21:26

Tags: Up For Grabs PR Gold partner

Is duplicated by: U4-11009

Relates to: U4-7530

Steps to repro:

  • Create a file in the Views directory, for example CalendarItem.cshtml
  • Put some content in there
  • Go to the backoffice and create a new template called CalendarItem
  • You would expect the existing content of that file to appear in the template editor, yet it loads a default snippet
  • Saving will cause the file on disk to be overwritten

A similar thing will happen when you create a new document type with the name CalendarItem

1 Attachments


Lennard Fonteijn 18 Aug 2017, 21:36:20

This is partially resolved where Umbraco already doesn't overwrite the template anymore you've made in VS prior to adding them.

Sebastiaan Janssen 26 Jun 2018, 12:03:25

@Shandem Since this has gotten no attention, it seems like this is no longer a priority, can this be closed or what can we do to move it forward?

Lennard Fonteijn 26 Jun 2018, 14:59:04

It is still a little wonky. When I create a template in Visual Studio, and add it to Umbraco, Umbraco overwrites it with a blank template. It has gone from not working, to working, to not working again. I personally don't really care for a watcher, I don't mind adding the templates myself. As long as Umbraco doesn't mess with them if the file exists!

Stefan Kip 26 Jun 2018, 15:04:02

exactly, but that shouldn't be the case according to U4-7530

Shannon Deminick 27 Jun 2018, 00:42:26

If the issue still exists that we overwrite an existing template file with a blank one then i think we should update this issue title and look at fixing that. I agree, we don't need a watcher.

Sebastiaan Janssen 27 Jun 2018, 06:46:38

Just checked, this is still a problem. I've updated the issue with steps to repro and put it into Up for grabs if anyone wants to run with it and fix it.

Nathan Woulfe 29 Jun 2018, 10:58:57

How bout this => https://github.com/umbraco/Umbraco-CMS/pull/2742

Priority: Normal

Type: Feature (request)

State: Fixed


Difficulty: Normal


Backwards Compatible: True

Fix Submitted: Pull request

Affected versions: 7.11.0, 7.11.1

Due in version: 7.12.0


Story Points: