Visual Studio Development Bookmark and Share   
 index > Visual Studio Guidance Automation Toolkit > Custom Argument Type and History of T4
 

Custom Argument Type and History of T4

Hi everyone,

I have been researching and learning about GAT for about 1 week now. I think the following links are very helpful examples:

http://www.softwarefactoriestoolkit.net/

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=909524&SiteID=1

http://www.guidanceautomation.net/cs/library/View.aspx?tab=3&Id=40

I am having problems declaring custom Argument type. So I have the following XML in the GAT XML file.

CodeGenerationTest is the Guidance Package namespace and EntityInfo is a class with three property EntityName, EntityDisplayName and EntityType. All of them are string type.

<Argument Name="CustomType" Type="CodeGenerationTest.EntityInfo, CodeGenerationTest">

<ValueProvider Type="CodeGenerationTest.ValueProviders.CustomTypeValueProvider, CodeGenerationTest" />

</Argument>

In the CustomTypeValueProvider I have the following code to set some value

public override bool OnBeginRecipe(object currentValue, out object newValue)

{

EntityInfo lEntity = new EntityInfo("FundCategoryCode", "Fund Category Code", "String");

newValue = lEntity;

return true;

}

Following I have the T4 template and here is the problem. It cannot recognize CustomType. What I want to do is

use <#= this.CustomType.EntityName #>.

<#@ property processor="PropertyProcessor" name="CustomType" #>

<#@ assembly name="System.dll" #>

Do I need to do something like the following?

<#@ property processor="PropertyProcessor" name="CustomType" , type="CodeGenerationTest.EntityInfo, CodeGenerationTest" #>

Do I need to add an Import statement?

It seems It can't find CustomType's type. the type is EntityInfo. What am I doing wrong?

One more question? Whats the history of T4 template? Who invented this? Is it currently being used to generate ASP .NET code?

Sy _  Monday, September 24, 2007 8:25 PM
Hi,
yes, you must use the <#@ import namespace="" #> statement, in your case something like this:
<#@ import namespace="CodeGenerationTest" #>

hth
jose.
Jose Escrich  Tuesday, September 25, 2007 1:58 AM
Regarding the history of T4.

T4 evolved from T3, an early prototype developed by p&p previous to GAX development. The DSL Tools team took ownership of T3 and evolved this into what's known today as T4.

The DSL Tools team has now merged into the VS SDK team, so you can know expect T4 bits to be included "into the platform" starting from Orcas. That is, you won't need to install the VS SDK as you need today (or the DSL redist) as you need today in order to get the runtime, it will be there, already in the box.

T4 templates can be used to generate any text files, so it can be easily used to generate ASP.Net code. Note that although ASP.Net markup pages and T4 template markup look very similar they're not the same thing. In other words the ASP.Net is not using T4 (but you could use T4 to generate ASP.net pages later used by ASP.Net).

Lastly, but not least, Clarius will be very soon releasing a standalone T4 editor (which is an enhanced version of the T4 editor found today on the Clarius SFT) which will enhance the T4 editing experience a lot inside Visual Studio.

HTH,
-Victor.

vga  Tuesday, September 25, 2007 3:03 AM
Hi,
yes, you must use the <#@ import namespace="" #> statement, in your case something like this:
<#@ import namespace="CodeGenerationTest" #>

hth
jose.
Jose Escrich  Tuesday, September 25, 2007 1:58 AM
Regarding the history of T4.

T4 evolved from T3, an early prototype developed by p&p previous to GAX development. The DSL Tools team took ownership of T3 and evolved this into what's known today as T4.

The DSL Tools team has now merged into the VS SDK team, so you can know expect T4 bits to be included "into the platform" starting from Orcas. That is, you won't need to install the VS SDK as you need today (or the DSL redist) as you need today in order to get the runtime, it will be there, already in the box.

T4 templates can be used to generate any text files, so it can be easily used to generate ASP.Net code. Note that although ASP.Net markup pages and T4 template markup look very similar they're not the same thing. In other words the ASP.Net is not using T4 (but you could use T4 to generate ASP.net pages later used by ASP.Net).

Lastly, but not least, Clarius will be very soon releasing a standalone T4 editor (which is an enhanced version of the T4 editor found today on the Clarius SFT) which will enhance the T4 editing experience a lot inside Visual Studio.

HTH,
-Victor.

vga  Tuesday, September 25, 2007 3:03 AM

I am already using a Text Editor by http://www.softwarefactoriestoolkit.net/#

Anyway, my question wasn't about using T4 to generate ASP .NET code. We know that ASP .NET is a similar to a code generation tool. It does generate java script and html. right? what language microsoft's programmers used to generate javascript and html? is it T4 engine?

Problem: Cannot get the Guidance Package Tasks to show when I try to access it from a VB project.

I noticed all the examples of generating code using GAT are C#. Is it possible to add a VB class to a VB project? I looked at CSharpProjectRecipeReference in Microsoft.Practices.RecipeFramework.Library.AssetReferences.UnboundReferences
. However, there is nothing for VB. I know we can always write custom AssetReference. I am gonna give it a try.

Thanks

Sy _  Wednesday, September 26, 2007 8:18 PM

Thank you for the answer.

Sy _  Thursday, October 18, 2007 4:07 AM

You can use google to search for other answers

Custom Search

More Threads

• Selective wizard page display
• February 07 GAX
• Re: How to develop a design center for my website.
• Newb Question: Where to get started on item template and documentation
• Visual Studio hangs when I install the T4Editor!!
• How to lauch a recipe programatically
• Unable to uninstall or reinstall SCSF
• URGENT: Project and Item Templates issue!
• What is the benefit of using GAT versus implementing patterns
• Simple class template reference