0

While loading a template in Tridion web 8.5, the code fails to resolve the assembly. and throws the error

could not compile template.
   at Tridion.ContentManager.Templating.Assembly.CSharpSourceCodeMediator.CompileAssembly(String templateCode)
   at Tridion.ContentManager.Templating.Assembly.CSharpSourceCodeMediator.<>c__DisplayClass14_0.<Transform>b__0()
   at Tridion.ContentManager.AssemblyCache.AssemblyCache.<>c__DisplayClass12_0.<GetOrAddAssemblyCacheInfo>b__0(String _)
   at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
   at Tridion.ContentManager.AssemblyCache.AssemblyCache.GetOrAddAssemblyCacheInfo(String script, Func`1 getAssembly, String keyAddition)
   at Tridion.ContentManager.AssemblyCache.AssemblyCache.GetInstanceOfType[T](String script, Func`1 generateAssembly, String typeName, Func`2 getType, String keyAddition)
   at Tridion.ContentManager.Templating.Assembly.CSharpSourceCodeMediator.Transform(Engine engine, Template template, Package package)
   at Tridion.ContentManager.Templating.Engine.ExecuteTemplate(Template template, Package package)
   at Tridion.ContentManager.Templating.Engine.InvokeTemplate(Package package, TemplateInvocation templateInvocation, Template template)
   at Tridion.ContentManager.Templating.Compound.CompoundTemplateMediator.Transform(Engine engine, Template templateToTransform, Package package)
   at Tridion.ContentManager.Templating.Engine.ExecuteTemplate(Template template, Package package)
   at Tridion.ContentManager.Templating.Engine.InvokeTemplate(Package package, TemplateInvocation templateInvocation, Template template)
   at Tridion.ContentManager.Templating.Engine.TransformPackage(Template template, Package package)
   at Tridion.ContentManager.Templating.Engine.TransformItem(Template template, IdentifiableObject itemToRender)
   at Tridion.ContentManager.Templating.Debugging.DebuggingEngine.Run()
   at Tridion.ContentManager.Templating.Debugging.DebugSession.Run()
---Caused by:
Could not compile C# source code, because of: Could not load file or assembly or one of its dependencies. The system cannot find the file specified..
  • Are you using the TcmUploadAssembly to load the templates into the CM? – Sabarish Senthilnathan Mar 11 at 20:51
  • 1
    could you share (parts of) the .net code of your template? Is your .Net code referencing non-tridion dlls/libraries? In that case, those dlls should either be added to your tbb dll using ILMerge, or I believe it would also work if those dlls are added to the GAC of your server. – Harald Hoffelinck Mar 12 at 9:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.