<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.3.3" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>
<channel>
	<title>Comments on: Understanding T4: &#60;#@ template #&#62; directive</title>
	<link>http://www.olegsych.com/2008/02/t4-template-directive/</link>
	<description>Me.Write(code)</description>
	<pubDate>Fri, 12 Mar 2010 12:01:20 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.3</generator>
		<item>
		<title>By: Using T4 Templates for Simple DTOs</title>
		<link>http://www.olegsych.com/2008/02/t4-template-directive/#comment-2397</link>
		<dc:creator>Using T4 Templates for Simple DTOs</dc:creator>
		<pubDate>Wed, 28 Oct 2009 01:31:52 +0000</pubDate>
		<guid>http://www.olegsych.com/2008/02/t4-template-directive/#comment-2397</guid>
		<description>[...] If you want to use the C# 3.5 compiler and LINQ features, make sure to use the correct template and assembly directives. Oleg Sych has the details: Understanding T4: &#60;#@ template #&#62; directive. [...]</description>
		<content:encoded><![CDATA[<p>[&#8230;] If you want to use the C# 3.5 compiler and LINQ features, make sure to use the correct template and assembly directives. Oleg Sych has the details: Understanding T4: &lt;#@ template #&gt; directive. [&#8230;]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: VS2008 T4 Template ja hostspecific - Iga lahendus tekitab uusi probleeme ehk alati võib leida veel ühe bugi.</title>
		<link>http://www.olegsych.com/2008/02/t4-template-directive/#comment-2266</link>
		<dc:creator>VS2008 T4 Template ja hostspecific - Iga lahendus tekitab uusi probleeme ehk alati võib leida veel ühe bugi.</dc:creator>
		<pubDate>Thu, 17 Sep 2009 06:13:28 +0000</pubDate>
		<guid>http://www.olegsych.com/2008/02/t4-template-directive/#comment-2266</guid>
		<description>[...] Oleg Sychi postitusi T4 mallide kohta. Olen ka neile varem viidanud. Nüüd viitaks konkreetselt T4 Template direktiivile. Seal see lahendus [...]</description>
		<content:encoded><![CDATA[<p>[&#8230;] Oleg Sychi postitusi T4 mallide kohta. Olen ka neile varem viidanud. Nüüd viitaks konkreetselt T4 Template direktiivile. Seal see lahendus [&#8230;]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Justin B</title>
		<link>http://www.olegsych.com/2008/02/t4-template-directive/#comment-1272</link>
		<dc:creator>Justin B</dc:creator>
		<pubDate>Wed, 29 Apr 2009 13:00:49 +0000</pubDate>
		<guid>http://www.olegsych.com/2008/02/t4-template-directive/#comment-1272</guid>
		<description>Thanks Oleg.</description>
		<content:encoded><![CDATA[<p>Thanks Oleg.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Oleg Sych</title>
		<link>http://www.olegsych.com/2008/02/t4-template-directive/#comment-1271</link>
		<dc:creator>Oleg Sych</dc:creator>
		<pubDate>Wed, 29 Apr 2009 12:12:54 +0000</pubDate>
		<guid>http://www.olegsych.com/2008/02/t4-template-directive/#comment-1271</guid>
		<description>Justing, please take a look at the Visual Studio T4 Host section at http://www.olegsych.com/2008/02/t4-include-directive/</description>
		<content:encoded><![CDATA[<p>Justing, please take a look at the Visual Studio T4 Host section at <a href="http://www.olegsych.com/2008/02/t4-include-directive/" rel="nofollow">http://www.olegsych.com/2008/02/t4-include-directive/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Justin B</title>
		<link>http://www.olegsych.com/2008/02/t4-template-directive/#comment-1258</link>
		<dc:creator>Justin B</dc:creator>
		<pubDate>Tue, 28 Apr 2009 13:41:51 +0000</pubDate>
		<guid>http://www.olegsych.com/2008/02/t4-template-directive/#comment-1258</guid>
		<description>This might be out of the realm of T4 Template processing, but I have a really simple issue that I can't solve.
I have a Base Template that contains Database connection information. Then I have a child of that Base template that does all the work generating the file. I then have a Child of the Child that sets specific parameters that will be used in the middle tier template to generate the text. If I separate them into a nice folder structure using relative paths in the include directive's it throws and error saying: "Failed to resolve include text for file:{0} " on the Base template. If I throw them all in the same folder and update the include directives it then works fine.  I know the relative paths for the folder structures check out since its simple like: Folder1 contains BaseTemplate.tt, Folder2 a sub folder of Folder1 contains ChildBase.tt, Folder3 a sub folder of Folder2 contains Child.tt.
Child.tt include: 
ChildBase.tt include: </description>
		<content:encoded><![CDATA[<p>This might be out of the realm of T4 Template processing, but I have a really simple issue that I can&#8217;t solve.<br />
I have a Base Template that contains Database connection information. Then I have a child of that Base template that does all the work generating the file. I then have a Child of the Child that sets specific parameters that will be used in the middle tier template to generate the text. If I separate them into a nice folder structure using relative paths in the include directive&#8217;s it throws and error saying: &#8220;Failed to resolve include text for file:{0} &#8221; on the Base template. If I throw them all in the same folder and update the include directives it then works fine.  I know the relative paths for the folder structures check out since its simple like: Folder1 contains BaseTemplate.tt, Folder2 a sub folder of Folder1 contains ChildBase.tt, Folder3 a sub folder of Folder2 contains Child.tt.<br />
Child.tt include:<br />
ChildBase.tt include:</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Oleg Sych</title>
		<link>http://www.olegsych.com/2008/02/t4-template-directive/#comment-1212</link>
		<dc:creator>Oleg Sych</dc:creator>
		<pubDate>Wed, 25 Mar 2009 10:50:07 +0000</pubDate>
		<guid>http://www.olegsych.com/2008/02/t4-template-directive/#comment-1212</guid>
		<description>Alexey, 

Could you provide specific details about the problem you are experiencing with ResolvePath?

Oleg</description>
		<content:encoded><![CDATA[<p>Alexey, </p>
<p>Could you provide specific details about the problem you are experiencing with ResolvePath?</p>
<p>Oleg</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alexey Baskakov</title>
		<link>http://www.olegsych.com/2008/02/t4-template-directive/#comment-1211</link>
		<dc:creator>Alexey Baskakov</dc:creator>
		<pubDate>Wed, 25 Mar 2009 03:44:26 +0000</pubDate>
		<guid>http://www.olegsych.com/2008/02/t4-template-directive/#comment-1211</guid>
		<description>ITextTemplatingEngineHost.ResolvePath isn't described at MSDN and it doesn't work for me. I need it very much! Could you fix it?</description>
		<content:encoded><![CDATA[<p>ITextTemplatingEngineHost.ResolvePath isn&#8217;t described at MSDN and it doesn&#8217;t work for me. I need it very much! Could you fix it?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike Baker</title>
		<link>http://www.olegsych.com/2008/02/t4-template-directive/#comment-337</link>
		<dc:creator>Mike Baker</dc:creator>
		<pubDate>Fri, 01 Aug 2008 00:53:59 +0000</pubDate>
		<guid>http://www.olegsych.com/2008/02/t4-template-directive/#comment-337</guid>
		<description>For what it's worth, I discovered the answer to my original question – how to get VS 2008 to run a template when building (although now I don’t plan to use it as my final solution, per Oleg's advice).

Here’s how to do it:

1. View the properties of the project file (.csproj).

2. Add a pre-build step as follows (for a template called foo.tt):
"C:\Program Files\Common Files\Microsoft Shared\TextTemplating\1.2\TextTransform" -out $(ProjectDir)\foo.cs -I $(ProjectDir) $(ProjectDir)\foo.tt

3. Save and build.

Good luck,
-Mike</description>
		<content:encoded><![CDATA[<p>For what it&#8217;s worth, I discovered the answer to my original question – how to get VS 2008 to run a template when building (although now I don’t plan to use it as my final solution, per Oleg&#8217;s advice).</p>
<p>Here’s how to do it:</p>
<p>1. View the properties of the project file (.csproj).</p>
<p>2. Add a pre-build step as follows (for a template called foo.tt):<br />
&#8220;C:\Program Files\Common Files\Microsoft Shared\TextTemplating\1.2\TextTransform&#8221; -out $(ProjectDir)\foo.cs -I $(ProjectDir) $(ProjectDir)\foo.tt</p>
<p>3. Save and build.</p>
<p>Good luck,<br />
-Mike</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike Baker</title>
		<link>http://www.olegsych.com/2008/02/t4-template-directive/#comment-336</link>
		<dc:creator>Mike Baker</dc:creator>
		<pubDate>Thu, 31 Jul 2008 21:02:56 +0000</pubDate>
		<guid>http://www.olegsych.com/2008/02/t4-template-directive/#comment-336</guid>
		<description>Thanks for the sound advice, Oleg.  

Originally I checked in the generated .cs files so as to not break the build, but given your perspectives, it sounds like it is also the final solution.
-Mike</description>
		<content:encoded><![CDATA[<p>Thanks for the sound advice, Oleg.  </p>
<p>Originally I checked in the generated .cs files so as to not break the build, but given your perspectives, it sounds like it is also the final solution.<br />
-Mike</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Oleg Sych</title>
		<link>http://www.olegsych.com/2008/02/t4-template-directive/#comment-335</link>
		<dc:creator>Oleg Sych</dc:creator>
		<pubDate>Thu, 31 Jul 2008 20:28:10 +0000</pubDate>
		<guid>http://www.olegsych.com/2008/02/t4-template-directive/#comment-335</guid>
		<description>Mike, 

To transform T4 templates during build you could use Elton Stoneman's  &lt;a href="http://geekswithblogs.net/EltonStoneman/archive/2008/07/25/an-msbuild-task-to-execute-t4-templates.aspx" rel="nofollow"&gt;MSBuild task for transforming T4 templates&lt;/a&gt; and customize MSBuild scripts to compile the output files they generate. However, unless you remove TextTemplatingFileGenerator custom tool from .tt file properties, Visual Studio will continue transforming the templates every time you save them.  

I'm not sure this approach is better than code generation at design time only, which is what T4 and other code generation tools in Visual Studio are designed to do. I would be particularly concerned about not having the generated source code stored in source control repository. Because development environment can change, there is no guarantee that you can regenerate the exact same code that was shipped or delivered to production months or years ago. Troubleshooting and debugging in this situation becomes very challenging.

Oleg</description>
		<content:encoded><![CDATA[<p>Mike, </p>
<p>To transform T4 templates during build you could use Elton Stoneman&#8217;s  <a href="http://geekswithblogs.net/EltonStoneman/archive/2008/07/25/an-msbuild-task-to-execute-t4-templates.aspx" rel="nofollow">MSBuild task for transforming T4 templates</a> and customize MSBuild scripts to compile the output files they generate. However, unless you remove TextTemplatingFileGenerator custom tool from .tt file properties, Visual Studio will continue transforming the templates every time you save them.  </p>
<p>I&#8217;m not sure this approach is better than code generation at design time only, which is what T4 and other code generation tools in Visual Studio are designed to do. I would be particularly concerned about not having the generated source code stored in source control repository. Because development environment can change, there is no guarantee that you can regenerate the exact same code that was shipped or delivered to production months or years ago. Troubleshooting and debugging in this situation becomes very challenging.</p>
<p>Oleg</p>
]]></content:encoded>
	</item>
</channel>
</rss>
