I have a custom class written "GetTcmUriFromWebDav" which inherits TBBFrameworkBuildingBlock. When trying to use this class in a component, it throws an error and it fails to initialize assembly and searches for some reference. The Same works in Tridion 2011 but fails in Web 8.5
public class GetTcmUriFromWebDav : TBBFrameworkBuildingBlock
{
public override void ExecuteTransform(ITBBFrameworkContext tbbContext)
{
// tbbContext.LogDebug("Testing ITG-Getting into GetTcmUriFromWebDav ");
tbbContext.LogDebug("Processing [{0}] parameters to retrieve TcmUri values for:", tbbContext.QueryString.Count);
foreach (String variableKey in tbbContext.QueryString.AllKeys)
{
Stopwatch timer = new Stopwatch();
if (!variableKey.IsNullOrEmpty())
{
//Retrieve the Value for the current Key
String itemWebDavOrTcmUri = tbbContext[variableKey];
if (!itemWebDavOrTcmUri.IsNullOrEmpty())
{
//Output detailed information that is being processed if Enhanced Debug output is enabled.
tbbContext.LogDebug(" - Package Variable Name: {0}", variableKey);
tbbContext.LogDebug(" - WebDav Url: {0}", itemWebDavOrTcmUri);
//Ensure the benchmark timer is running and reset for the current retrieval.
timer.Restart();
string pubwedav = tbbContext.GetContextPublication().WebDavUrl.ToString();
itemWebDavOrTcmUri = pubwedav + itemWebDavOrTcmUri;
//Retrieve the TcmUri of the Tridion Item
var tridionItem = tbbContext.RetrieveItemAsObject(itemWebDavOrTcmUri);
TcmUri tcmUri = tridionItem != null ? tridionItem.Id : null;
//Output detailed benchmarch retrival time for performance testing
tbbContext.LogDebug(" - Tridion Retrival Time: [{0}] seconds", timer.Elapsed.TotalSeconds);
//Now push the Final value into the Package
String strTcmUri = tcmUri.ToString();
tbbContext.PushTextDataIntoPackage(variableKey, strTcmUri);
tbbContext.LogDebug(" - Added variable to Package: {0} == {1}", variableKey, strTcmUri);
}
else
{
tbbContext.LogDebug(" - Unable to add variable to Package; Zero length WebDav parameters are not allowed: {0}", tbbContext.GetQueryStringFullString());
}
}
else
{
tbbContext.LogDebug(" - Unable to add variable to Package; Zero length variable names are not allowed: {0}", tbbContext.GetQueryStringFullString());
}
}
}
##error##
Debugging was started in process 'TcmTemplateDebugHost' with id 7552
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 'HP.Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f9dca51171614d83' or one of its dependencies. The system cannot find the file specified..
at Tridion.ContentManager.CSharpCodeCompiler.LoadAssemblies(IEnumerable`1 assemblies)
at Tridion.ContentManager.CSharpCodeCompiler.CompileAssembly(String code, String namespaceName, String classDeclaration, String methodName, CompilationPurpose compilationPurpose, Type methodType, String usingDeclarations, IDictionary`2 properties, IEnumerable`1 additionalReferencedAssemblies, String customDeclarations, String outputAssemblyPath)
at Tridion.ContentManager.Templating.Assembly.CSharpSourceCodeMediator.CompileAssembly(String templateCode)
---Caused by:
Could not load file or assembly 'HP.Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f9dca51171614d83' or one of its dependencies. The system cannot find the file specified.
at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection)
at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.Load(String assemblyString)
at Tridion.ContentManager.CSharpCodeCompiler.<>c.<LoadAssemblies>b__8_0(String assembly)
at System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at Tridion.ContentManager.CSharpCodeCompiler.LoadAssemblies(IEnumerable`1 assemblies)