This project is read-only.

Where is the T4Toolbox dll installed for the VS2012?

May 30, 2013 at 11:16 PM
Edited May 30, 2013 at 11:17 PM
Do I need to add a reference to the T4Toolbox in my project or perhaps within the template itself using the assembly directive? I can't seem to get access to the multi-file output stuff? How do T4 Templates know about the T4Toolbox?

Where is the dll for the T4Toolbox?
Jun 6, 2013 at 10:37 PM
This puzzled me when I started using the T4 Toolbox.
I assume you have installed T4 Toolbox from VisualStudioGallery, via Tools/Extensions.

In a project, add a New Item from the T4 Toolbox menu. You'll see three Script, Generator and Template.
Generator and Template need to be renamed as .ttinclude
In the, you'll see a line
<#@ include file="" #>

that's what kicks it off.
VS2012 will find the .tt, which is in your user extensions directory, and include the T4ToolBox dll.
Clever, yes!

Now can you do something?
When you have an initial simple template running using one of each of these three tts running. Try debugging using the contect menu on the tt file - Debug T4 template.
For me it crashes.

Jun 12, 2013 at 2:03 PM
I get the exception following exception when I try to debug a T4 Script.

System.NullReferenceException was unhandled by user code
Message=Object reference not set to an instance of an object.
Server stack trace: 
   at T4Toolbox.VisualStudio.TransformationContextProvider.T4Toolbox.ITransformationContextProvider.GetMetadataValue(Object hierarchyObject, String fileName, String metadataName)
   at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
   at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)
Exception rethrown at [0]: 
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at T4Toolbox.ITransformationContextProvider.GetMetadataValue(Object hierarchy, String fileName, String metadataName)
   at T4Toolbox.TransformationContext.GetMetadataValue(String metadataName)
   at T4Toolbox.TransformationContext.InitializeParameters()
   at T4Toolbox.TransformationContext..ctor(TextTransformation transformation, StringBuilder generationEnvironment)
   at T4Toolbox.TransformationContext.Initialize(TextTransformation transformation, StringBuilder generationEnvironment)
   at Microsoft.VisualStudio.TextTemplating58E328C4E42138E06AFB28F7843374620BC7ECE51B3BF6825D8F9045B3FE4D5D908F64E871CEE92F4FE3E1E2CF5C13AA3840EC4EB06CFC91434D43A4DDCE48F4.GeneratedTextTransformation.Initialize() in c:\Users\friemanm\Documents\Visual Studio 2012\Projects\ConsoleApplication1\ConsoleApplication1\ 16
   at CallSite.Target(Closure , CallSite , Object )
   at System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid1[T0](CallSite site, T0 arg0)
   at Microsoft.VisualStudio.TextTemplating.TransformationRunner.PerformTransformation()
Jun 12, 2013 at 5:18 PM
Thanks for responding.
Seems we both have same, But I have not yet tried the lastest version that was released a few days ago.
I did report this to Oleg.