Tridion User Interface 2012 - Can't find Razor helpers when creating pages/inserting content

297 Views Asked by At

I'm working with Tridion 2011 SP1 and Razor templating but have an issue with creating pages and inserting content through the User Interface 2012. It appears when I try this that my Razor helpers, namespaces and assemblies listed in the Tridion.ContentManager.config file don't get included.

I tried adding the references to the helpers directly in the razor templates and everything works fine but I would prefer to not have to do this in every Razor Template.

When I try creating a page through the UI I get the following Razor error:

TemplateCompileException: CS0103: The name 'GetBreadcrumbStatus' does not exist 
in the current context Line 64 Column 21: if(GetBreadcrumbStatus())

My Tridion.ContentManager.config file contains the following for the Razor Mediator:

<razor.mediator cacheTime="600" extractBinaries="true">
 <namespaces>
  <add namespace="Tridion.Extensions.Mediators.Razor.Models" /> 
  <add namespace="System.Linq" />
 </namespaces>
 <imports>
  <add import="C:\Program Files (x86)\Tridion\Razor Mediator\Helpers\GeneralHelper.cshtml" />
 </imports>
</razor.mediator>

Any ideas as to why the UI doesn't include the helpers and namespaces unless there referenced directly in the Razor templates?

Thanks in advance.

1

There are 1 best solutions below

2
On BEST ANSWER

Some background on the Session Preview mechanism

The new UI uses a special type of publisher for its Session Preview mechanism, which optimizes the publishing process to get the "near real time" behavior that people expect in such an environment. The optimized publisher accomplishes this by skipping certain steps, one of which is reducing the resolving process (so fewer items get publishes) and not invoking custom resolvers.

On your problem

Are your Razor templates invoked at all when you create the new page?