We have installed the razor mediator, and are now testing to see if we can save a Razor template building block. When saving a TBB we got the following message:

Attempting to create Session - razor config attribute 'adminUser' is required to use this feature Unable to save Template Building Block (tcm:0-0-0)

We attempted a quick fix by simply configuring an admin user, but to get that working will require that we configure impersonation. (Which might be worth considering, but that's not what this question is about.)

The question is: why doesn't this work when we have no imports configured? The documentation says it shouldn't be necessary. I've just had a quick look at the code, and GetImportTemplateContent(), seems to be the only place that creates a Session. This in turn is only called by ImportIncludes(), which only calls it if an include is found in the configuration or in the content. I don't have the opportunity right now to get this under a debugger, so any insights would be welcomed.

Edit: Would there be any downside in having the Session property simply use the other overload of Tridion's Session constructor if no admin were configured?

1 Answer 1


I think it may have something to do with the option to allow Where Used relationships for Razor TBBs, I haven't traced the code through, but I think when a template is compiled it updates the Where used relationships, even if there are no imports, but for this it needs a session.

Try setting includeImportWhereUsed to false, and while you are at it probably includeConfigWhereUsed to false also (in Tridion.ContentManager.config).

  • 1
    Yup - that made the problem go away. It's a workaround really, because that's functionality that should be switched on, but "he who fights and runs away lives to fight another day". Commented Jan 27, 2014 at 22:01
  • Add an issue for it, I can probably pick it up as its in the same area as Issue 12 - when I get round to looking at that.
    – Will Price
    Commented Jan 28, 2014 at 7:02
  • Did anyone ever fix this defect above? Commented Apr 13, 2016 at 16:23
  • I don't think so - I never did in any case
    – Will Price
    Commented Apr 14, 2016 at 14:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.