<?xml version="1.0"?><?xml-stylesheet type="text/xsl" href="/rss.xsl"?><rss version="2.0"><channel><title>t4toolbox Forum Rss Feed</title><link>http://www.codeplex.com/t4toolbox/Thread/List.aspx</link><description>t4toolbox Forum Rss Description</description><item><title>New Post: Can't Debug T4 Template using VS2012 feature</title><link>http://t4toolbox.codeplex.com/discussions/444575</link><description>&lt;div style="line-height: normal;"&gt;Remove the T4Toolbox.tt line, and it debugs just fine&lt;br /&gt;
With it present, I get the exception as shown above&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;#@ template  debug=&amp;quot;true&amp;quot; hostSpecific=&amp;quot;true&amp;quot; #&amp;gt;
&amp;lt;#@ output extension=&amp;quot;.cs&amp;quot; #&amp;gt;
&amp;lt;#@ include file=&amp;quot;T4Toolbox.tt&amp;quot; #&amp;gt;
&amp;lt;#
    var t = new test();
#&amp;gt;
&amp;lt;#+
public class test
{
    public test()
    {
    }
}
#&amp;gt;&lt;/code&gt;&lt;/pre&gt;

As afar as I can see the source for the VS2012 is not available here.&lt;br /&gt;
Pity...&lt;br /&gt;
&lt;/div&gt;</description><author>jradxl</author><pubDate>Wed, 22 May 2013 16:27:34 GMT</pubDate><guid isPermaLink="false">New Post: Can't Debug T4 Template using VS2012 feature 20130522042734P</guid></item><item><title>New Post: Can't Debug T4 Template using VS2012 feature</title><link>http://t4toolbox.codeplex.com/discussions/444575</link><description>&lt;div style="line-height: normal;"&gt;Hi,&lt;br /&gt;
If I use the context menu item &amp;quot;Debug T4 Template&amp;quot; it always crashes as the debuging starts.&lt;br /&gt;
If I use the old method of Debugger.Launch() and Break() I can debug just fine.&lt;br /&gt;
&lt;br /&gt;
Since the stack trace mentions T4Toolbox, I'm just wondering if this is a T4Toolbox issue?&lt;br /&gt;
&lt;br /&gt;
Thanks&lt;br /&gt;
&lt;br /&gt;
Server stack trace: &lt;br /&gt;
   at T4Toolbox.VisualStudio.TransformationContextProvider.T4Toolbox.ITransformationContextProvider.GetMetadataValue(Object hierarchyObject, String fileName, String metadataName)&lt;br /&gt;
   at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]&amp;amp; outArgs)&lt;br /&gt;
   at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)&lt;br /&gt;
&lt;br /&gt;
Exception rethrown at [0]: &lt;br /&gt;
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)&lt;br /&gt;
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&amp;amp; msgData, Int32 &lt;br /&gt;
&lt;/div&gt;</description><author>jradxl</author><pubDate>Wed, 22 May 2013 11:53:01 GMT</pubDate><guid isPermaLink="false">New Post: Can't Debug T4 Template using VS2012 feature 20130522115301A</guid></item><item><title>New Post: When will Proprocessed Templates be support in VS2012?</title><link>http://t4toolbox.codeplex.com/discussions/444307</link><description>&lt;div style="line-height: normal;"&gt;Hi Oleg,&lt;br /&gt;
&lt;br /&gt;
We rely on Preprocessed Templates for some of the work that we do.  We are migrating to VS2012 very soon.  Will you be adding preprocessed template support anytime soon?&lt;br /&gt;
&lt;br /&gt;
Mike&lt;br /&gt;
&lt;/div&gt;</description><author>bit7</author><pubDate>Mon, 20 May 2013 16:54:04 GMT</pubDate><guid isPermaLink="false">New Post: When will Proprocessed Templates be support in VS2012? 20130520045404P</guid></item><item><title>New Post: Where to put code that use the generated files ?</title><link>http://t4toolbox.codeplex.com/discussions/442613</link><description>&lt;div style="line-height: normal;"&gt;Hi Oleg,&lt;br /&gt;
i use T4Toolbox since 5 years.&lt;br /&gt;
&lt;br /&gt;
I have a .tt file which generates N files by calling Render() on classes inheriting CSharpTemplate.&lt;br /&gt;
&lt;br /&gt;
At the end of the .tt file, i want to load one of the generated files, but the file never exists at this time. If i run the template by hand in VS2012, all files are generated ok.&lt;br /&gt;
&lt;br /&gt;
Where to put this code ?&lt;br /&gt;
&lt;br /&gt;
Benjamin.&lt;br /&gt;
&lt;/div&gt;</description><author>softlion</author><pubDate>Sun, 05 May 2013 18:17:46 GMT</pubDate><guid isPermaLink="false">New Post: Where to put code that use the generated files ? 20130505061746P</guid></item><item><title>New Post: Unknown Type CSharpTemplate</title><link>http://t4toolbox.codeplex.com/discussions/437156</link><description>&lt;div style="line-height: normal;"&gt;So in other words, when I add a new Template item to a project, the symbol &lt;em&gt;CSharpTemplate&lt;/em&gt; will be unresolved? Actually, I'll get no intellisense whatsoever for all T4Toolbox-related types and members, e.g. &lt;em&gt;TransformationContext&lt;/em&gt; or &lt;em&gt;CSharpTemplate&lt;/em&gt;, right? &lt;br /&gt;
At least, this is what's happening for me now and I wonder if this is normal or am I just doing something wrong. I have working T4 files, but everything from T4Toolbox is unrecognised, so it looks like there are errors in these files. Not to mention the fact, that lack of intellisense is painful while developing.&lt;br /&gt;
&lt;strong&gt;OlegSych wrote:&lt;/strong&gt;&lt;br /&gt;
&lt;blockquote&gt;
In Visual Studio 2010, there is a project item template that will automatically add the required reference to your project.&lt;br /&gt;
&lt;/blockquote&gt;
Have I understood you correctly then, that there are some references, that might be added manually in VS2012? Would that help?&lt;br /&gt;
I'd be pleased, if you'd explain this for me.&lt;br /&gt;
&lt;/div&gt;</description><author>slawekal</author><pubDate>Mon, 08 Apr 2013 20:38:18 GMT</pubDate><guid isPermaLink="false">New Post: Unknown Type CSharpTemplate 20130408083818P</guid></item><item><title>New Post: Moving T4 Toolbox LINQ to SQL classes generator into our source code</title><link>http://t4toolbox.codeplex.com/discussions/438390</link><description>&lt;div style="line-height: normal;"&gt;I've been looking into moving our Linq to SQL generation over to using T4 templates for some time now but have had a tough time finding a project that has been maintained and allows for at least results that are comparable with the out of the box experience offered by DBML within Visual Studio. &lt;br /&gt;
&lt;br /&gt;
I've checked out the T4 Toolbox along with many of your very informative posts and just recently began looking into how to use T4 Toolbox for the purpose described above. Unfortunately we are using Visual Studio 2012 and since your pulling out support for the out of the box generator for Linq to SQL I'm following your suggestion and looking for some support for how to get some of the capabilities pushed directly into our project source code. You did mention NuGet being a better source for distributing such T4 templates but I don't see any decent ones available for Linq to SQL that are not also trying to lock users into some new custom ORM. At this point I'm wondering how much effort it would take to pull out the LINQ to SQL related parts of the templates that used to be supplied with the T4 Toolkit and place them directly into my project. &lt;br /&gt;
&lt;br /&gt;
I've attempted to do this but after remapping a few files paths to point to a folder where I stuck the .tt files I get this result when trying to run my main DataContext level template DataClasses1.tt which looks like below.&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;#@ template language=&amp;quot;C#&amp;quot; debug=&amp;quot;True&amp;quot; #&amp;gt;
&amp;lt;#@ output extension=&amp;quot;cs&amp;quot; #&amp;gt;
&amp;lt;#@ include file=&amp;quot;T4Toolbox.tt&amp;quot; #&amp;gt;
&amp;lt;#@ include file=&amp;quot;LinqToSql.tt&amp;quot; #&amp;gt;
&amp;lt;#
    // Generate entity classes from a LINQ to SQL class model (.dbml file)
    LinqToSqlGenerator generator = new LinqToSqlGenerator();
    generator.DbmlFile = &amp;quot;DataClasses2.dbml&amp;quot;
    generator.Run();
#&amp;gt;&lt;/code&gt;&lt;/pre&gt;

When I do this see errors like the ones listed below which makes it look like I will need somehow to get the code parts of the T4 Toolbox like TransactSqlTemplate in order to get this stuff working. Seeing that I don't want to create my own Visual Studio add-in to get this working I was wondering if you could point me in the right direction or give a yes or no answer about where what I'm attempting to do is feasible given that I would rather spend less than a couple of hours to get this working.&lt;br /&gt;
&lt;br /&gt;
Error	1	Compiling transformation: The type or namespace name 'TransactSqlTemplate' could not be found (are you missing a using directive or an assembly reference?)	c:\Users\me\Documents\Visual Studio 2012\Projects\LinqToSqlT4TemplateTest\LinqToSqlT4TemplateTest\LinqToSql\LinqToSqlTableBase.tt	9	52	LinqToSqlT4TemplateTest&lt;br /&gt;
Error	2	Compiling transformation: The type or namespace name 'Database' could not be found (are you missing a using directive or an assembly reference?)	c:\Users\me\Documents\Visual Studio 2012\Projects\LinqToSqlT4TemplateTest\LinqToSqlT4TemplateTest\LinqToSql\LinqToSqlDataContextTemplate.tt	30	12	LinqToSqlT4TemplateTest&lt;br /&gt;
Error	3	Compiling transformation: The type or namespace name 'Connection' could not be found (are you missing a using directive or an assembly reference?)	c:\Users\me\Documents\Visual Studio 2012\Projects\LinqToSqlT4TemplateTest\LinqToSqlT4TemplateTest\LinqToSql\LinqToSqlDataContextTemplate.tt	137	34	LinqToSqlT4TemplateTest&lt;br /&gt;
Error	4	Compiling transformation: 'Microsoft.VisualStudio.TextTemplatingDFF1CCA611C0C4496ECFC13E4C4CD837B4EE01EAECC109EF12C6697C3023A14BFC1CB5084D3FAB4B5A337AF8F9B9E92D7E1B27894AF2916A961947C6928737EE.GeneratedTextTransformation.LinqToSqlDataContextTemplate.Database' is a 'property' but is used like a 'type'	c:\Users\me\Documents\Visual Studio 2012\Projects\LinqToSqlT4TemplateTest\LinqToSqlT4TemplateTest\LinqToSql\LinqToSqlDataContextTemplate.tt	166	34	LinqToSqlT4TemplateTest&lt;br /&gt;
Error	5	Compiling transformation: The type or namespace name 'Table' could not be found (are you missing a using directive or an assembly reference?)	c:\Users\me\Documents\Visual Studio 2012\Projects\LinqToSqlT4TemplateTest\LinqToSqlT4TemplateTest\LinqToSql\LinqToSqlDataContextTemplate.tt	191	34	LinqToSqlT4TemplateTest&lt;br /&gt;
Error	6	Compiling transformation: The type or namespace name 'Association' could not be found (are you missing a using directive or an assembly reference?)	c:\Users\me\Documents\Visual Studio 2012\Projects\LinqToSqlT4TemplateTest\LinqToSqlT4TemplateTest\LinqToSql\LinqToSqlEntityClassTemplate.tt	56	45	LinqToSqlT4TemplateTest&lt;br /&gt;
Error	7	Compiling transformation: The type or namespace name 'Column' could not be found (are you missing a using directive or an assembly reference?)	c:\Users\me\Documents\Visual Studio 2012\Projects\LinqToSqlT4TemplateTest\LinqToSqlT4TemplateTest\LinqToSql\LinqToSqlEntityClassTemplate.tt	62	45	LinqToSqlT4TemplateTest&lt;br /&gt;
Error	8	Compiling transformation: 'Microsoft.VisualStudio.TextTemplatingDFF1CCA611C0C4496ECFC13E4C4CD837B4EE01EAECC109EF12C6697C3023A14BFC1CB5084D3FAB4B5A337AF8F9B9E92D7E1B27894AF2916A961947C6928737EE.GeneratedTextTransformation.LinqToSqlEntityClassTemplate.AccessModifier(Association)' is a 'method' but is used like a 'type'	c:\Users\me\Documents\Visual Studio 2012\Projects\LinqToSqlT4TemplateTest\LinqToSqlT4TemplateTest\LinqToSql\LinqToSqlEntityClassTemplate.tt	1343	36	LinqToSqlT4TemplateTest&lt;br /&gt;
Error	9	Compiling transformation: The type or namespace name 'MemberModifier' could not be found (are you missing a using directive or an assembly reference?)	c:\Users\me\Documents\Visual Studio 2012\Projects\LinqToSqlT4TemplateTest\LinqToSqlT4TemplateTest\LinqToSql\LinqToSqlEntityClassTemplate.tt	1354	36	LinqToSqlT4TemplateTest&lt;br /&gt;
Error	10	Compiling transformation: 'Microsoft.VisualStudio.TextTemplatingDFF1CCA611C0C4496ECFC13E4C4CD837B4EE01EAECC109EF12C6697C3023A14BFC1CB5084D3FAB4B5A337AF8F9B9E92D7E1B27894AF2916A961947C6928737EE.GeneratedTextTransformation.LinqToSqlTableBaseTemplate.Table' is a 'property' but is used like a 'type'	c:\Users\me\Documents\Visual Studio 2012\Projects\LinqToSqlT4TemplateTest\LinqToSqlT4TemplateTest\LinqToSql\LinqToSqlTableBase.tt	46	40	LinqToSqlT4TemplateTest&lt;br /&gt;
Error	11	A namespace cannot directly contain members such as fields or methods	C:\Users\me\Documents\Visual Studio 2012\Projects\LinqToSqlT4TemplateTest\LinqToSqlT4TemplateTest\DataClasses1.cs	1	1	LinqToSqlT4TemplateTest&lt;br /&gt;
Error	12	A namespace cannot directly contain members such as fields or methods	C:\Users\me\Documents\Visual Studio 2012\Projects\LinqToSqlT4TemplateTest\LinqToSqlT4TemplateTest\LinqToSql.cs	1	1	LinqToSqlT4TemplateTest&lt;br /&gt;
&lt;/div&gt;</description><author>kainhart</author><pubDate>Thu, 28 Mar 2013 23:13:15 GMT</pubDate><guid isPermaLink="false">New Post: Moving T4 Toolbox LINQ to SQL classes generator into our source code 20130328111315P</guid></item><item><title>New Post: running t4 script file from the command prompt</title><link>http://t4toolbox.codeplex.com/discussions/437636</link><description>&lt;div style="line-height: normal;"&gt;While you can transform simple text templates using &lt;a href="http://msdn.microsoft.com/en-us/library/bb126245.aspx" rel="nofollow"&gt;TextTransform&lt;/a&gt;, the T4 runtime environment it provides is completely different from Visual Studio. T4 Toolbox does not support TextTransform at this time.&lt;br /&gt;
&lt;/div&gt;</description><author>OlegSych</author><pubDate>Sun, 24 Mar 2013 16:04:56 GMT</pubDate><guid isPermaLink="false">New Post: running t4 script file from the command prompt 20130324040456P</guid></item><item><title>New Post: running t4 script file from the command prompt</title><link>http://t4toolbox.codeplex.com/discussions/437636</link><description>&lt;div style="line-height: normal;"&gt;I have a  VS 2012 console project which generates the code files by using T4 Toolbox. Currently, I run the code generation script file by selecting 'Run custom Tool' from the popup menu in VS. I wonder if I can run the script file from the Command Prompt.&lt;br /&gt;
&lt;/div&gt;</description><author>tjdwl</author><pubDate>Fri, 22 Mar 2013 14:25:53 GMT</pubDate><guid isPermaLink="false">New Post: running t4 script file from the command prompt 20130322022553P</guid></item><item><title>New Post: T4ScriptFileGenerator VS2012</title><link>http://t4toolbox.codeplex.com/discussions/437168</link><description>&lt;div style="line-height: normal;"&gt;In Visual Studio 2012 the name of the Custom Tool is T4Toolbox.ScriptFileGenerator.&lt;br /&gt;
&lt;/div&gt;</description><author>OlegSych</author><pubDate>Thu, 21 Mar 2013 14:13:38 GMT</pubDate><guid isPermaLink="false">New Post: T4ScriptFileGenerator VS2012 20130321021338P</guid></item><item><title>New Post: Unknown Type CSharpTemplate</title><link>http://t4toolbox.codeplex.com/discussions/437156</link><description>&lt;div style="line-height: normal;"&gt;T4Toolbox in Visual Studio 2012 does not support pre-processed templates at this time. In Visual Studio 2010, there is a project item template that will automatically add the required reference to your project.&lt;br /&gt;
&lt;/div&gt;</description><author>OlegSych</author><pubDate>Thu, 21 Mar 2013 14:12:41 GMT</pubDate><guid isPermaLink="false">New Post: Unknown Type CSharpTemplate 20130321021241P</guid></item><item><title>New Post: T4ScriptFileGenerator VS2012</title><link>http://t4toolbox.codeplex.com/discussions/437168</link><description>&lt;div style="line-height: normal;"&gt;Ho do you make an xml file generate a template with T4ScriptFileGenerator?&lt;br /&gt;
&lt;br /&gt;
I try adding &amp;quot;T4ScriptFileGenerator&amp;quot; as a Custom Tool on my xml file in my project, but nothing happens.&lt;br /&gt;
&lt;/div&gt;</description><author>mika76</author><pubDate>Tue, 19 Mar 2013 10:02:23 GMT</pubDate><guid isPermaLink="false">New Post: T4ScriptFileGenerator VS2012 20130319100223A</guid></item><item><title>New Post: Unknown Type CSharpTemplate</title><link>http://t4toolbox.codeplex.com/discussions/437156</link><description>&lt;div style="line-height: normal;"&gt;I am trying to create a preprocessed template in my project.  The problem is that I continue to get an unknown type.  I am assuming that I need to add a reference to my project but I am not sure where to find the dll.  Can you please point me in the right direction.&lt;br /&gt;
&lt;/div&gt;</description><author>kmcbrearty</author><pubDate>Tue, 19 Mar 2013 06:34:34 GMT</pubDate><guid isPermaLink="false">New Post: Unknown Type CSharpTemplate 20130319063434A</guid></item><item><title>New Post: Using T4 Toolbox To Generate Java Executables</title><link>http://t4toolbox.codeplex.com/discussions/434751</link><description>&lt;div style="line-height: normal;"&gt;Never mind.&lt;br /&gt;
&lt;br /&gt;
I think I fixed it.&lt;br /&gt;
&lt;br /&gt;
The variable declaration needed to be at the bottom&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;#@ template language=&amp;quot;C#&amp;quot; #&amp;gt;
&amp;lt;#@ template debug=&amp;quot;true&amp;quot; #&amp;gt;
&amp;lt;#@ assembly name=&amp;quot;System.Core&amp;quot; #&amp;gt;
&amp;lt;#@ import namespace=&amp;quot;System.Linq&amp;quot; #&amp;gt;
&amp;lt;#@ import namespace=&amp;quot;System.Text&amp;quot; #&amp;gt;
&amp;lt;#@ import namespace=&amp;quot;System.Collections.Generic&amp;quot; #&amp;gt;

&amp;lt;#= stringVal #&amp;gt; 

&amp;lt;#+ public string stringVal;  #&amp;gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;</description><author>drdexter333</author><pubDate>Mon, 04 Mar 2013 17:15:30 GMT</pubDate><guid isPermaLink="false">New Post: Using T4 Toolbox To Generate Java Executables 20130304051530P</guid></item><item><title>New Post: Using T4 Toolbox To Generate Java Executables</title><link>http://t4toolbox.codeplex.com/discussions/434751</link><description>&lt;div style="line-height: normal;"&gt;Ok, So i set everything up like so in my form:&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;using (myStream = openFileDialog1.OpenFile())
{
string file = Path.GetFileName(openFileDialog1.InitialDirectory + openFileDialog1.FileName);
string text = File.ReadAllText(openFileDialog1.FileName);
    try
    {
        MacroTemplate mt = new MacroTemplate();
        mt.stringVal = text;
        File.WriteAllText(&amp;quot;MyClass.java&amp;quot;, mt.TransformText());
    }
    catch (Exception ex)
    {
       MessageBox.Show(&amp;quot;An error occurred&amp;quot; + ex.GetBaseException());
    }
}            &lt;/code&gt;&lt;/pre&gt;

Then in my template:&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;#@ template language=&amp;quot;C#&amp;quot; #&amp;gt;
&amp;lt;#@ template debug=&amp;quot;true&amp;quot; #&amp;gt;

&amp;lt;#+
    public string stringVal;
    
#&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

My java file is empty and I cannot figure out how to write output statement in the template file since each time I attempt to code a block following this line:&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;#+
    public string stringVal;
    
#&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

I get this error:&lt;br /&gt;
Error	1	A Statement cannot appear after the first class feature in the template. Only boilerplate, expressions and other class features are allowed after the first class feature block.&lt;br /&gt;
&lt;br /&gt;
How do i write this variable out to the file?&lt;br /&gt;
&lt;br /&gt;
Thanks&lt;br /&gt;
&lt;br /&gt;
Doug&lt;br /&gt;
&lt;/div&gt;</description><author>drdexter333</author><pubDate>Mon, 04 Mar 2013 16:33:54 GMT</pubDate><guid isPermaLink="false">New Post: Using T4 Toolbox To Generate Java Executables 20130304043354P</guid></item><item><title>New Post: Windows Forms and Generating Code</title><link>http://t4toolbox.codeplex.com/discussions/435130</link><description>&lt;div style="line-height: normal;"&gt;You might want to start here: &lt;a href="http://msdn.microsoft.com/en-us/library/ee844259.aspx" rel="nofollow"&gt;http://msdn.microsoft.com/en-us/library/ee844259.aspx&lt;/a&gt;&lt;br /&gt;
&lt;/div&gt;</description><author>OlegSych</author><pubDate>Mon, 04 Mar 2013 03:07:03 GMT</pubDate><guid isPermaLink="false">New Post: Windows Forms and Generating Code 20130304030703A</guid></item><item><title>New Post: Using T4 Toolbox To Generate Java Executables</title><link>http://t4toolbox.codeplex.com/discussions/434751</link><description>&lt;div style="line-height: normal;"&gt;In a Windows application, you can only use a preprocessed (a.k.a. runtime) template. Look at the .CS file the runtime template generates in your project to understand how to use it. You probably want to declare the &amp;quot;stringVal&amp;quot; as a property in a class feature block. &lt;br /&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;#+ 
    public string StringVal;
#&amp;gt;&lt;/code&gt;&lt;/pre&gt;

That way, you will be able to set it in your windows form like so:&lt;br /&gt;
&lt;br /&gt;
preMacro macro = new preMacro();&lt;br /&gt;
macro.StringVal = &amp;quot;Value&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
After that, you can save the generated code in a .java file:&lt;br /&gt;
&lt;br /&gt;
File.WriteAllText(&amp;quot;MyClass.java&amp;quot;, macro.TransformText());&lt;br /&gt;
&lt;br /&gt;
You may find the following articles helpful in understanding preprocessed templates: &lt;a href="http://msdn.microsoft.com/en-us/library/ee844259.aspx" rel="nofollow"&gt;http://msdn.microsoft.com/en-us/library/ee844259.aspx&lt;/a&gt;&lt;br /&gt;
&lt;/div&gt;</description><author>OlegSych</author><pubDate>Mon, 04 Mar 2013 03:05:24 GMT</pubDate><guid isPermaLink="false">New Post: Using T4 Toolbox To Generate Java Executables 20130304030524A</guid></item><item><title>New Post: Windows Forms and Generating Code</title><link>http://t4toolbox.codeplex.com/discussions/435130</link><description>&lt;div style="line-height: normal;"&gt;I'm kind of struggling in an attempt to create a dynamic code generator using T4&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;I have a windows app that reads mutilple files.&lt;/li&gt;
&lt;li&gt;
For each file read, I need to collection of code snippets, in a java file.&lt;br /&gt;
&lt;/li&gt;
&lt;/ol&gt;
I used Tangible t4 Editor and created a new tt file like this:&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;#@ template debug=&amp;quot;true&amp;quot; hostSpecific=&amp;quot;true&amp;quot; #&amp;gt;
&amp;lt;#@ output extension=&amp;quot;.java&amp;quot; #&amp;gt;
&amp;lt;#@ Assembly Name=&amp;quot;System.Core&amp;quot; #&amp;gt;
&amp;lt;#@ Assembly Name=&amp;quot;System.Windows.Forms&amp;quot; #&amp;gt;
&amp;lt;#@ import namespace=&amp;quot;System&amp;quot; #&amp;gt;
&amp;lt;#@ import namespace=&amp;quot;System.IO&amp;quot; #&amp;gt;
&amp;lt;#@ import namespace=&amp;quot;System.Diagnostics&amp;quot; #&amp;gt;
&amp;lt;#@ import namespace=&amp;quot;System.Linq&amp;quot; #&amp;gt;
&amp;lt;#@ import namespace=&amp;quot;System.Collections&amp;quot; #&amp;gt;
&amp;lt;#@ import namespace=&amp;quot;System.Collections.Generic&amp;quot; #&amp;gt; 
&amp;lt;#
   // insert your template code here the tempalte code will be syntaxhighlighted 
   // and you will have intellisense for all namespaces in the full edition
   string Greeting = &amp;quot;Hello&amp;quot;;
#&amp;gt;
// This is the output code from your template
// you only get syntax-highlighting here - not intellisense
namespace JAVA_UTILITY{
  class MyGeneratedClass{
     static void main (string[] args){
       System.Console.WriteLine(&amp;quot;&amp;lt;#= Greeting #&amp;gt;, the time is now: &amp;lt;#=System.DateTime.Now.ToString() #&amp;gt;&amp;quot;);
}

     
     
  }

&amp;lt;#+
  // Insert any template procedures here
  void foo(){}
#&amp;gt;&lt;/code&gt;&lt;/pre&gt;

The problem I am having a hard time wrapping my head around is, &lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;How this tt.file gets called at run time &lt;/li&gt;
&lt;li&gt;
How do I  access and set say a collection of properties within this .tt file?&lt;br /&gt;
&lt;/li&gt;
&lt;/ol&gt;
Thanks in advance for any help.&lt;br /&gt;
&lt;br /&gt;
Doug&lt;br /&gt;
&lt;/div&gt;</description><author>drdexter333</author><pubDate>Sat, 02 Mar 2013 18:30:56 GMT</pubDate><guid isPermaLink="false">New Post: Windows Forms and Generating Code 20130302063056P</guid></item><item><title>New Post: Using T4 Toolbox To Generate Java Executables</title><link>http://t4toolbox.codeplex.com/discussions/434751</link><description>&lt;div style="line-height: normal;"&gt;Ok I get that.&lt;br /&gt;
&lt;br /&gt;
What I'm trying to do is generate some java code on the fly using these t4 templates&lt;br /&gt;
&lt;br /&gt;
Here's where I am stuck:&lt;br /&gt;
&lt;br /&gt;
I attempted to create a standard text template with an output type of .java, however I'm trying to figure out how to access properties from that template in order to set values at runtime.&lt;br /&gt;
&lt;br /&gt;
IE:&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;#@ template debug=&amp;quot;false&amp;quot; hostspecific=&amp;quot;false&amp;quot; language=&amp;quot;C#&amp;quot; #&amp;gt;
&amp;lt;#@ output extension=&amp;quot;.java&amp;quot; #&amp;gt;
&amp;lt;#@ import namespace=&amp;quot;System.IO&amp;quot;#&amp;gt;
public class macro {

    public string stringVal;
    public static void main(String[] args) {}
}&lt;/code&gt;&lt;/pre&gt;

At runtime in my windows form I need to&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;grab that stringVal variable and set it to some macro code&lt;/li&gt;
&lt;li&gt;
wrap it up into a java class file.&lt;br /&gt;
&lt;/li&gt;
&lt;/ol&gt;
I wasn't so sure that I could do it with a text template, so I attempted a preprocessed template:&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;#@ template language=&amp;quot;C#&amp;quot; #&amp;gt;
&amp;lt;#@ assembly name=&amp;quot;System.Core&amp;quot; #&amp;gt;
&amp;lt;#@ import namespace=&amp;quot;System.Linq&amp;quot; #&amp;gt;
&amp;lt;#@ import namespace=&amp;quot;System.Text&amp;quot; #&amp;gt;
&amp;lt;#@ import namespace=&amp;quot;System.Collections.Generic&amp;quot; #&amp;gt;

public class preMacro{

    &amp;lt;# String stringVal= String.Empty;  #&amp;gt; 

        
} &lt;/code&gt;&lt;/pre&gt;

Now it seems i have access to this object in my windows form:&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;preMacro macro = new preMacro();&lt;/code&gt;&lt;/pre&gt;

however I'm not sure how to access that stringVal in the template and set it at runtime&lt;br /&gt;
&lt;br /&gt;
thanks&lt;br /&gt;
&lt;/div&gt;</description><author>drdexter333</author><pubDate>Sat, 02 Mar 2013 14:10:32 GMT</pubDate><guid isPermaLink="false">New Post: Using T4 Toolbox To Generate Java Executables 20130302021032P</guid></item><item><title>New Post: Using T4 Toolbox To Generate Java Executables</title><link>http://t4toolbox.codeplex.com/discussions/434751</link><description>&lt;div style="line-height: normal;"&gt;T4 Toolbox is a Visual Studio extension for generating text files.&lt;br /&gt;
&lt;/div&gt;</description><author>OlegSych</author><pubDate>Thu, 28 Feb 2013 02:50:07 GMT</pubDate><guid isPermaLink="false">New Post: Using T4 Toolbox To Generate Java Executables 20130228025007A</guid></item><item><title>New Post: v11.3 - Setting Output.BuildAction?</title><link>http://t4toolbox.codeplex.com/discussions/434463</link><description>&lt;div style="line-height: normal;"&gt;It's been renamed to Output.ItemType; you can set it to ItemType.EmbeddedResource.&lt;br /&gt;
&lt;/div&gt;</description><author>OlegSych</author><pubDate>Thu, 28 Feb 2013 02:47:30 GMT</pubDate><guid isPermaLink="false">New Post: v11.3 - Setting Output.BuildAction? 20130228024730A</guid></item></channel></rss>