RazorEngine - Namespace import compilation error

I'm using the Razor Engine (razorengine.codeplex.com) in a non-MVC environment. I compile templates that are stored in files and use @inherits for intellisense support.

  • RazorEngine Assembly
  • Custom Assembly - references RazorEngine, contains View and sets View as baseclass
  • Web application - references RazorEngine, Custom Assembly, contains .cshtml template files

All cshtml files have the following @inherits directive:

@inherits View

An error is thrown:

The type of namespace View isn't found, are you missing an assembly reference?

My web.config contains the following entry:


I think this has something to do with the other entry , where my CustomAssembly isn't mentioned. Is this the case? Can I compile with my custom base class which is contained in another assembly?

p.s. I cannot retrieve a strong name for the assembly because my custom assembly references a 3d party assembly which isn't strongly named either...

Stacktrace:

at RazorEngine.Compilation.DirectCompilerServiceBase.CompileType(TypeContext context)
at RazorEngine.Templating.TemplateService.CreateTemplate(String template, Type modelType)
at RazorEngine.Templating.TemplateService.GetTemplate(String template, Type modelType, String name)
at RazorEngine.Templating.TemplateService.Compile(String template, Type modelType, String name)
at RazorEngine.Razor.Compile(String template, Type modelType, String name)

6
задан Peter 24 September 2015 в 09:29
поделиться