I have got some .tt files in my solution for a long time. I recently decided to launch the transformation at build time by adding to my csproj :
<PropertyGroup>
<TransformOnBuild>true</TransformOnBuild>
<TransformOutOfDateOnly>false</TransformOutOfDateOnly>
</PropertyGroup>
I have a first .tt file (First.tt) which includes a second .tt file (Second.tt) from another project of the same solution:
<#@ include file="..\SecondProject\Second.tt" #>
In Second.tt, I include T4Toolbox.tt :
<#@ include file="T4Toolbox.tt" #>
Everything is ok when I launch First.tt by using right click -> run custom tool. But when I rebuild the solution, I obtain this error : Failed to resolve include text for file:E:\Dev\MySolution\FirstProject..\SecondProject\T4Toolbox.tt
So I try to use the installation path of T4ToolBox.tt :
<#@ include file="C:\Program Files\T4 Toolbox\T4Toolbox.tt" #>
But I have got another error : A processor named 'T4Toolbox.DteProcessor' could not be found for the directive named 'dte'
If anybody can help, it would be great !
EDIT : I have not succeeded but it is better. I removed the rooted path in Second.tt and I have added the following lines into the csproj of FirstProject :
<PropertyGroup>
<IncludeFolders>C:\Program Files\T4 Toolbox</IncludeFolders>
</PropertyGroup>
<DirectiveProcessor Include="T4Toolbox.DteProcessor" >
<Class>T4Toolbox.DteProcessor</Class>
<CodeBase>C:\Program Files\T4 Toolbox\Bin\T4Toolbox.10.0.dll</CodeBase>
</DirectiveProcessor>
<DirectiveProcessor Include="T4Toolbox.TransformationContextProcessor" >
<Class>T4Toolbox.TransformationContextProcessor</Class>
<CodeBase>C:\Program Files\T4 Toolbox\Bin\T4Toolbox.10.0.dll</CodeBase>
</DirectiveProcessor>
When I try to build, the dte processor is found but I have still an error : An Exception was thrown while running the transformation code. The process cannot continue. The following Exception was thrown:
System.NullReferenceException: Object reference not set to an instance of an object.
at T4Toolbox.DteProcessor.UpdateFiles(ICollection`1 outputFiles)
at T4Toolbox.OutputManager.UpdateFiles()
at System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate)
at System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate)
at T4Toolbox.TransformationContext.OnTransformationEnded(TextTransformation transformation)
at Microsoft.VisualStudio.TextTemplating7C4960D0E15B020F44790E9542C211BF.GeneratedTextTransformation.Dispose(Boolean disposing) in E:\Dev\MySolution\FirstProject\First.tt:line 18
at Microsoft.VisualStudio.TextTemplating.TextTransformation.Dispose()
at Microsoft.VisualStudio.TextTemplating.TransformationRunner.RunTransformation(TemplateProcessingSession session, String source, ITextTemplatingEngineHost host, String& result). Line=0, Column=0 E:\Dev\Tools\Microsoft\Microsoft.TextTemplating.targets 397 5 FirstProject