Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Rich Green 2246 posts 4008 karma points
    May 01, 2011 @ 00:30
    Rich Green
    0

    Unable to load 'RazorEngine.Templates'

    Hey,

    I'm getting errors when deploying a site to my server, the sites works fine of my local machine.

    None of the XSLT files are rendering (Error parsing XSLT file: \)

    If I try to save an XSLT file in the back end I get the error below.

    System.Exception: Unable to load one or more of the types in assembly 'RazorEngine.Templates, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Exceptions were thrown:
    System.IO.FileNotFoundException: Could not load file or assembly 'System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
    System.IO.FileNotFoundException: Could not load file or assembly 'System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. 
    at umbraco.BusinessLogic.Utils.TypeFinder.FindClassesMarkedWithAttribute(Assembly assembly, Type attribute) 
    at umbraco.BusinessLogic.Utils.TypeFinder.FindClassesMarkedWithAttribute(Type attribute) 
    at umbraco.macro.GetXsltExtensionsImpl() 
    at umbraco.cms.businesslogic.cache.Cache.GetCacheItem[TT](String cacheKey, Object syncLock, CacheItemPriority priority, CacheItemRemovedCallback refreshAction, CacheDependency cacheDependency, TimeSpan timeout, GetCacheItemDelegate`1 getCacheItem) 
    at umbraco.macro.GetXsltExtensions() 
    at umbraco.macro.AddMacroXsltExtensions() 
    at umbraco.presentation.webservices.codeEditorSave.SaveXslt(String fileName, String oldName, String fileContents, Boolean ignoreDebuggin

    I have other Umbraco 4.7 sites running fine on the same server.

    Sure I saw a similar post recently but can't find it.

    Any ideas?

    Rich

  • Rich Green 2246 posts 4008 karma points
    May 01, 2011 @ 12:07
    Rich Green
    0

    For reference, I've resolved this, though don't really know exactly what fixed it.

    I deleted all the dlls, copied over all the dlls from a clean 4.7 install across, recopied my 3rd party / custom dlls and it started working.

    Rich

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Aug 08, 2011 @ 14:30
    Sebastiaan Janssen
    0

    I have the same problem, except the error only shows up when you first visit the site after an application pool recycle. After that it doesn't show until the next recycle.

    Why this happens I am not sure, but I'm going to try to install MVC2 and 3 on the server and see if that helps (it should). However, maybe including the System.Web.Mvc (v2.0) dll in the bin folder would be enough? It's a bit confusing as Razor was built into MVC3, not 2, so I'm not sure why you'd need to have 2 in there.

  • Anthony Dang 1404 posts 2558 karma points MVP 3x c-trib
    Aug 08, 2011 @ 14:36
    Anthony Dang
    0

    I had something similar a while ago. I think it was because System.Web.Razor was not referenced. I'm not sure if that is the same issue though.

     

     

     

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Aug 08, 2011 @ 14:38
    Sebastiaan Janssen
    0

    Hmmm, it's just a plain vanilla umbraco site though, no custom code. Just a simple Razor script.

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Aug 08, 2011 @ 15:10
    Sebastiaan Janssen
    0

    FYI it was indeed solved by installing MVC2 and 3 on the server, the error is gone now. 

  • Gareth Evans 143 posts 335 karma points c-trib
    Aug 12, 2011 @ 06:54
    Gareth Evans
    0

    Just encountered this issue on my development site which is based on a build of 4.7.1
    Indeed, RazorEngine.Templates has a reference to System.Web.MVC which is not part of the umbraco distribution.

    This fault will also prevent RazorDataTypeModels from working (which is how I got onto the issue) and probably extension methods on DynamicNode etc because we have to instantiate all the types, and if one of them is missing a dependency, then that fails.

    For me, I just renamed RazorEngine.Templates as RazorEngine.Templates.dll.ignore and everything started working, Despite the name, RazorEngines.Templates is a CodePlex project [http://razorengine.codeplex.com/] but I'm not sure which package installed it in my dev site.

    I've added (a lot of) tracing to my local macroEngines that shows up in umbDebugShowTrace to debug RazorDataTypeModel faults, as this is one of the flagship features of 4.7.1

    I'm not sure if I'll commit these traces, it makes the trace output very noisy.

    As Sebastiaan suggests, installing MVC2 or MVC3 will fix the issue, but you can also remove the DLL if you're not using it

    Gareth

     

Please Sign in or register to post replies

Write your reply to:

Draft