We are using T4-Templates to generate Code for all of our models. We have a multi project setup with multiple TDS projects.

We want to use multiple Base Template References (Multi-project Properties) within one TDS project to generate Templates with the correct namespace of the Base Template.

Let's say we have two base TDS Projects Base1 and Base2. In a third TDS project, we have a Template that inherits fields of both base projects.

I want it to look something like this:

public partial class Inheriting: GlassBase, global::Base1.Field1, global::Base2.Field2

I'm aware of this question here, but it is not generic enough to allow two or more base projects, if they have different Namespaces: https://stackoverflow.com/questions/31711197/sitecore-tds-multi-project-properties-base-template-reference-not-working-for-me

How can I tweak my .tt files to do this?

1 Answer 1


For the correct namespaces to work, you can use the Additional Code Generation Properties in the properties of the TDS base projects.

You could add the Property "TargetNamespace" with the values "Base1" and "Base2" respectively. For the inheriting TDS project, you'll need to modify the GetNamespace function in its helpers.tt file.

Instead of namespaceSegments.Add(defaultNamespace); you would do namespaceSegments.Add(!item.ReferencedItem ? defaultNamespace : item.AdditionalProperties["TargetNamespace"]); to get that Additional Property for all referenced Items.

Thanks to cturano in the Sitecore Community Slacks #tds channel.

Your Answer

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

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