I was trying to use the TemplateFileManager TT Include file (referenced from this article, and available in Tangible's template gallery) so that I could output multiple files from 1 T4 template, but I keep getting an error inside the default code. For some reason, this method returns null, and I cannot debug it easily enough to know why.
public static string GetProjectItemFullPath(EnvDTE.ProjectItem item)
{
return item.Properties.Item("FullPath").Value.ToString();
}
Anybody know why? I did download the latest version (2.1) from their template download tool. My usage was very straightforward; I was trying to write out 2 CSV files. I have this declared:
<#@ output extension=".csv" #>
<#@ include file="TemplateFileManager.ttinclude" #>
At the top I create the TemplateManager:
var manager = TemplateFileManager.Create(this);
and when I want to split, I have this:
manager.StartNewFile("Documentation.Features.csv");
And at the end:
manager.Process();
I can debug through to know that the issue is with CleanupTemplatePlaceholders routine:
var dirtyHelperTemplates = VSHelper.GetAllSolutionItems(this.dte)
.Where(p => delta.Contains(VSHelper.GetProjectItemFullPath(p)));
In this collection is an instance where something is null... (Object reference error).