Visual Studio Development Bookmark and Share   
 index > Visual Studio Extensibility > Problem with T4 include and VS dependency checking
 

Problem with T4 include and VS dependency checking

Hi,

I'm new to T4 and I'm trying to find out how to best split up large templates into multiple files.
I tried using the include directive, but this seems to be ignored by the Visual Studios /MSBuild dependency checker.

For example if I have two files: main.tt and x.ttinclude
where main.tt includes x.ttinclude.
I build the project in Visual Studio and everything works fine. Now I change x.ttinclude, hit build but Visual Studio does not retransform main.tt, even tough it should (IMO).
Is there a way to get VS to do this automatically without "Rebuild all" or manually identifying that main.tt has to be rebuilt?

Thanks.
rumxaml  Friday, June 26, 2009 4:39 PM
No, I'm afraid not. There is currently no in-the-box integration between MsBuild and T4. If you change x.ttinclude, you have to manually force a re-transform of main.tt (by clicking on the "Transform All" icon in the Solution Explorer, by right-clicking on main.tt in the Solution Explorer and selecting "Run custom tool", or by saving main.tt).

As a workaround, you could call the TextTransform.exe command line tool from a pre-build event in your project.

There are various extensions / toolkits for T4 out there that have be developed by third parties; it might be worth searching for those to see if they provide a better experience in this area. We do have a sample of T4 build tasks in the pipeline that provide better integration (e.g. transform all on build, warning about out of date files, transform out of date files), but I can't say if/when it will see the light of day. I'll post an update when I know more.

Regards,
Duncan
DuncanP  Friday, June 26, 2009 6:24 PM
No, I'm afraid not. There is currently no in-the-box integration between MsBuild and T4. If you change x.ttinclude, you have to manually force a re-transform of main.tt (by clicking on the "Transform All" icon in the Solution Explorer, by right-clicking on main.tt in the Solution Explorer and selecting "Run custom tool", or by saving main.tt).

As a workaround, you could call the TextTransform.exe command line tool from a pre-build event in your project.

There are various extensions / toolkits for T4 out there that have be developed by third parties; it might be worth searching for those to see if they provide a better experience in this area. We do have a sample of T4 build tasks in the pipeline that provide better integration (e.g. transform all on build, warning about out of date files, transform out of date files), but I can't say if/when it will see the light of day. I'll post an update when I know more.

Regards,
Duncan
DuncanP  Friday, June 26, 2009 6:24 PM
I see. Thanks for your in depth answer.

Cheers
rumxaml  Friday, June 26, 2009 9:10 PM

You can use google to search for other answers

Custom Search

More Threads

• Question on AutoExtender - Not working unless ComVisible(true)
• Deployment - I can't find the template
• Problem with Combo EventArgs
• Is there a source formater add-in?
• plugging into "Find and Replace" dialog possible?
• Connector inheritance problem
• Web Project Debugging
• SolutionExplorer custom folder
• What is the context menu name?
• Multiple DSL's using the same file extension