Team Development for Sitecore Model Inheritance
For a long time now I have been trying to find a way to have TDS models inherit across the Helix architecture.I found this link on StackOverflow:
https://stackoverflow.com/questions/31711197/sitecore-tds-multi-project-properties-base-template-reference-not-working-for-me
And thought it worth re-posting - Thanks to Rohan for figuring out how to do this!
All you have to do is to update Helpers.tt in the TDS project that needs to inherit base, as follows:
public static string GetNamespace(string defaultNamespace, SitecoreItem item, bool includeGlobal = false) { ListnamespaceSegments = new List (); // add the following line namespaceSegments.Add(!item.ReferencedItem ? defaultNamespace : "[BaseProjectNameSpace]"); // remove this line - namespaceSegments.Add(defaultNamespace); namespaceSegments.Add(item.Namespace); string @namespace = AsNamespace(namespaceSegments); // use an extension method in the supporting assembly return (includeGlobal ? string.Concat("global::", @namespace) : @namespace).Replace(".sitecore.templates", "").Replace("_", ""); }
Make sure that you replace the above [BaseProjectNameSpace] with your base projects namespace.
Also make sure you update the Multi-Project properties for your TDS project so that it references the base project: