Jason94
Jason94

Reputation: 13620

Template is not visible in backoffice, when created in VS

When I create a new template (.cshtml) in the Views folder of my Visual Studio solution it is not showing up in the backoffice. If I create a template from the backoffice a file is created in the Views folder that I then have to add to VS as a exciting file - why don't the backoffice show the template if I create one from Visual Studio? I've tried rebuilding the project.

Upvotes: 1

Views: 2130

Answers (2)

Morten OC
Morten OC

Reputation: 1784

You can do it in 2 ways:

  1. Create your views in umbraco backend. Then go to visual studio and click the "Show All Files" button in solution explore. Find your new views in the Views folder. Right click on each file and choose "Add file to project".
  2. Create your views in visual studio as normal. Then go to umbraco backend and create your Templates, and give them the same name as the view in visual studio. (If your template name in umbraco is "Text Page", -your file name should be "TextPage")

As ProNation says, all templates needs a db reference.

Upvotes: 2

ProNotion
ProNotion

Reputation: 3692

Views/templates work differently to some of the other files like scripts and CSS because they require a reference in the database to allow you to associate them with your doctypes.

Upvotes: 1

Related Questions