I'm getting started with tridion and i'm working on an "old" tridion project. With the template builder, i managed to see how the component models are built but i need to debug my C# code which is inside a block of construction of model (not sure about the translation in english, sorry).

How can i see when i debug with the template builder what a variable contains? Thanks in advance for your help.

For example, in the following code , i want for instance to see what "publicationTitle" contains:

<%@ Import Namespace="System.Collections.Generic" %>
<%@ Import Namespace="Tridion.ContentManager.ContentManagement.Fields" %>
log.Debug("Begin: GroupDocumentItems");

string publicationTitle = string.IsNullOrEmpty(package.GetValue("Page.Publication.Title")) ? package.GetValue("Component.Publication.Title") : package.GetValue("Page.Publication.Title");
package.PushItem("Output", package.CreateStringItem(ContentType.Text,publicationTitle);
Component comp = engine.GetSession().GetObject(package.GetValue("Component.ID")) as Component;
ItemFields fields = new ItemFields(comp.Content, comp.Schema);
TextField field = fields["pathFolder"] as TextField;
string location = field.Value;

List<TcmUri> list = new List<TcmUri>();

Filter componentFilter = new Filter();
componentFilter.Conditions.Add("Recursive", true);
componentFilter.Conditions.Add("ItemType", ItemType.Component);
OrganizationalItem oi = engine.GetSession().GetObject("/webdav/" + publicationTitle + location) as OrganizationalItem;
foreach (Component siblingComponent in oi.GetItems(componentFilter))
    if (siblingComponent.Schema.Title == "SC_document")
        list.Add (new TcmUri(siblingComponent.Id));
StringBuilder sb = new StringBuilder();
foreach (TcmUri tu in list)
    sb.Append("$(tfde:" + tu.ToString() + ";Document Item XML)");
package.PushItem("Output", package.CreateStringItem(ContentType.Text, sb.ToString()));
log.Debug("End: GroupDocumentItems");

And if possible, i would like to see it in the output tab in the template builder when i debug my component model under a specific component.

  • Hello, welcome FieryA and thanks for asking on Tridion Stack Exchange. If you're looking for values in Template Builder, that would be in the Package, which updates after each TBB "runs." Or are you looking for variables from your C# code (which you could also add to the Template Builder Package)? Nov 2, 2015 at 21:03
  • I have updated my answer. Maybe it's more clear for you now. Thanks for your help
    – FieryA
    Nov 4, 2015 at 12:32
  • Well, it seems i managed to make it work with package.PushItem("Output", package.CreateStringItem(ContentType.Text,publicationTitle); it appears in a tab while debugging. Is it the only way to debug ? Thanks !
    – FieryA
    Nov 4, 2015 at 12:36
  • So if you see "End: GroupDocuemntItems" in the debug window ... why not try log.Debug("value of sb: ") -and- log.Debug(sb.ToString()) Nov 4, 2015 at 13:50
  • Indeed, it seems a log framework like log.net was implemented but i didn't find where the log file is located in the server yet ...
    – FieryA
    Nov 4, 2015 at 14:51

2 Answers 2


It looks like you are attempting to debug a C# fragment building block. This is not going to work. (It's probably possible, but only as an exercise in esoteric intransigence.) It should be straightforward enough to copy and paste the code into Visual Studio and build it into proper assembly templates that you can debug.

Once you've done that, make a fresh debug build, upload it to Tridion with debug symbols, and attach a debugger in the standard way.


Did you read these

If you did - but they didn't suit then perhaps you can expand on what you have tried, what problems you encountered and what the technical setup is.

  • The links you have posted didn't help i think. I have updated my answer. Maybe it's more clear for you now. Thanks for your help
    – FieryA
    Nov 4, 2015 at 12:33

Your Answer

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

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