I am trying to set multi-project properties exactly like how it says in this link/article with base template reference to another TDS project. http://hedgehogdevelopment.github.io/tds/chapter4.html#multi-project-properties
Similar to the above link I have TDS Project TDS A that generates code in project X and TDS Project B (Base templates) that generates code in project Y. Project X references Y and TDS Project A references Project B in the Multi-project properties setting.
Sounds like I am doing what the article says. But the code generated from the TDS project A is not able to generate references to code generated by TDS Project B. To give an example of whats happening: So the right behavior is that class generated in Project X say Class D should inherit from base class say Class Base from Project Y, instead it creates its own version of fully qualified namespace for Class Base that does not exists. It uses its own assembly namespace ProjectX.tree.structure.BaseClass, when it should be ProjectY.tree.structure.BaseClass.
Has anyone got this to work. Am I missing something ?
I have got it to work by tweaking the T4 templates, but that's not the best solution
Thanks
Someone on the team helped me with this. This is not the best solution but should work if you have a setup as defined above. Trick is to modify the below method in the Helpers.tt template. Add the line marked with the comment. Should be able to extend this little further to not hardcode the base project namespace. Will post if I get around to figuring that.
public static string GetNamespace(string defaultNamespace, SitecoreItem item, bool includeGlobal = false)
{
List<string> namespaceSegments = new List<string>();
// add the following line
namespaceSegments.Add(!item.ReferencedItem ? defaultNamespace : "[BaseProjectNameSpace]");
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("_", "");
}