Virtual Happy Hour this month, Jun 28, we'll be getting a sneak preview at our soon to launch SaaS CMS!

Try our conversational search powered by Generative AI!

Add-on not finding Razor templates


I'm developing an add-on using Razor templates, but for some reason Episerver isn't looking for the Razor templates in the add-on Views path. I get the following error:

The view 'index' or its master was not found or no view engine supports the searched locations. The following locations were searched:

The correct ocation for the Razor template would be /yllapito/Solita.LanguageEditor.UI/Views/LanguageEditor/Index.cshtml. The template is found if I manually specify the path to view in the controller using Paths.ToResource(), but why isn't it found automatically?

Mar 28, 2013 14:46

As far as I know currently by default only WebForms view engine is supported for AddOn module. Just take a look at `EPiServer.Shell.Modules.ModuleInitializer' in `GetViewEngine(ShellModule module)' method.

Files .cs|vbhtml in ~/Views/.. are searched by default System.Web.Mvc.RazorViewEngine. Maybe more info could be found in

Mar 31, 2013 23:16

Make sure your Views folder contains a web.config file that contains references to Razor. You can e.g. create a new MVC4 project from Visual Studio and copy the config file from the Views folder to your Views folder.

Apr 02, 2013 8:49

There is a problem when creating protected addons with Razor views. The web.config file in /Views folder is ignored when the addon is installed in the virtual folder (and not under /modules as for public addons).

Is there someway to overcome this? For know I think we have to use ASPX-views for MVC controllers when creating protected add-ons.



Jul 17, 2013 11:01

I haven't been working with addons for a while now, but I remember that I had the same issue as Thomas that the addon's web.config file was completely ignored. This caused problems, since the Razor template couldn't find assemblies that were defined in the "missing" web.config file. In the end I just ended up using ASPX-views, which was pretty awkward after getting used to Razor goodness :(


Jul 26, 2013 13:00

Hi, everyone,

This seems to not work even nowadays. 

I have built this add-on for Episerver Forms and I could make it work almost all the way, except the Razor view never got picked up (no matter what I tried out).

If you grab the add-on code and simply change ascx file with the Razor version and update the Controller, it is not going to work unfortunately.

Then, I checked Episerver.Forms and they have the ascx files, too. it's kinda pitty if it's impossible to have Razor view in protected Add-Ons, I almost forgot how to write inside an ascx :)

Anyways, I am leaving this for someone who is building an add-on to find until it's fixed hopefully or maybe someone knows what I may have done wrong, if this was fixed in the meantime.

Jun 01, 2017 15:09

Jun 01, 2017 15:16
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.