Search code examples
tridiontridion-2011tridion-content-delivery

Tridion: Error loading Assembly 'Tridion.ContentDelivery.Interop'


We are converting VBScript templates to .net compound templates and are facing some issues while using Broker Query Mechanism.

Our Old code looks like:

sQuery = "query" & nNumber &  ".AddCriteria(""schema"",""="", ""1132"");"& vbcrlf
if objFields.Item("FilterBD").Value.Count >0 Then
     if objFields.Item("FilterBD").Value(1) = "Yes" Then
      sQuery = sQuery & "query" & nNumber & ".AddOperator(Query.QueryOperator.AND_Field);"& vbcrlf
         sQuery = sQuery & "query" & nNumber & ".AddCriteria(""categorization"", ""="", ""Broker_Dealer/test"");" & vbcrlf
     End If
End If

While converting this to .net, we added a reference of Tridion.ContentDelivery.DynamicContent dll to our project, so that we can write our code (sample) as:

using Tridion.ContentDelivery.DynamicContent.Query;
Tridion.ContentDelivery.DynamicContent.Query.Query query = new Tridion.ContentDelivery.DynamicContent.Query.Query();
ItemSchemaCriteria isArticle = new ItemSchemaCriteria(1132);
CategoryCriteria bdCategory = new CategoryCriteria("Broker_Dealer/\" + \"test\"");
Criteria bdCriteria = CriteriaFactory.And(isArticle, bdCategory);
query.Criteria = bdCriteria;

This approach is working well in Visual studio so far, but while Building our CT in template builder, we are getting the error "Could not load file or assembly 'Could not load file or assembly 'Tridion.ContentDelivery.Interop, Version=6.1.0.43, Culture=neutral, PublicKeyToken=ddfc895746e5ee6b' or one of its dependencies. The system cannot find the file specified.'

After following these Steps of registering the dlls in GAC, we are still receiving the same problem?

Anything we missed? Kindly help. Thanks.


Solution

  • If you need to query the Broker then a .Net TBB is not the place to do it. In your VBSscript template you appear to have been writing server-side code to your output, which is the correct approach. In your modular template you should take the same approach - either write out the appropriate .Net code or, probably a better approach, write out a .Net control tag which, when processed by IIS, will call the CD API directly.