Is there a reason why EditorTemplates are not added on publishing the MVC 5 app?

96 Views Asked by At

I have EditorTemplates directory under ~\Views\Items.

Everything works fine on local system.

I published the project on server, configured IIS and Started the application. It was rendering:

System.Data.Entity.DynamicProxies.Items.....

for 1:m views, where I was using EditorTemplates. I spent couple of hours searching and found solutions like: "it is due to lazy loading, turn it off by using .ToList()", "don't use nested entities in Views", "refactor your models and use ViewModels" etc. Some of those were not applicable, some did not work, and some required a lot more work than I anticipated: refactoring the ready-to-launch application.

Later I realized that the issue was with Views on deployment server missing the EditorTemplates directories, while the folder exists locally and source-control. The issue was fixed by manually copying EditorTemplates directory under ~\Views\Items.

  • Is there a reason why publish machinery ignores EditorTemplates directories?
  • Any way to configure it so it does not ignore those on publishing the application?
0

There are 0 best solutions below