Visual Studio Development Bookmark and Share   
 index > Visual Studio Guidance Automation Toolkit > Challenge in writing a T4 template with Arguments created onthe fly based on a xsd file
 

Challenge in writing a T4 template with Arguments created onthe fly based on a xsd file

Hi,

I want to write a T4 Template which will have properties (Get and Set).

The problem is these properties will be an input to the template from an xsd file.

Can somehelp throw somelight on how can I write such a template which will have properties generated based in an xsd file?

In short I want to generate a C# code file that will have properties defined based on the xsd file as input. I can't use xsd.exe because I also have to add inheritence to the generated file.

It's a big challenge for me can someone help me on this if you have any idea?

Thanks in advance.

radenb  Friday, February 29, 2008 8:33 AM

Hi,

You can create a Custom Directive Processor that "reads" the xsd and exposes its content as a property. You can than use that property in your t4 templates and use the normal t4 syntax to generate a class based on the contents of the XSD.

I noticed you already started this thread about Custom Directive Processors so I assume you know how to solve this now. Is that correct?

Edward

Edward Bakker  Saturday, March 01, 2008 3:35 PM

Hi,

You can create a Custom Directive Processor that "reads" the xsd and exposes its content as a property. You can than use that property in your t4 templates and use the normal t4 syntax to generate a class based on the contents of the XSD.

I noticed you already started this thread about Custom Directive Processors so I assume you know how to solve this now. Is that correct?

Edward

Edward Bakker  Saturday, March 01, 2008 3:35 PM

Hi Ed. You are right. But the problem is

The cutom directive is not woring as you see in my earlier post. I am still struggling to see why its giving me compile errors. Though it's just a copy paste from the msdn sample. It should have worked.

I am little frustrated becasue a simpel msdn sample is not working Sad

radenb  Monday, March 03, 2008 6:01 AM
Check this out:http://www.olegsych.com/2008/08/t4-xsd-directive/

G.Mavritsakis  Friday, July 17, 2009 10:03 PM

You can use google to search for other answers

Custom Search

More Threads

• Is there any way to automate the data repository mappings?
• Could not load WCSF project Microsoft.Practices.ComponentModel
• Can't Register or Unregister Recipe
• Any tutorial for GAT?
• Can I use .NET 3.5 assemblies in GAX Text Templates?
• Pull project from sourcesafe on unfold
• URGENT: Project and Item Templates issue!
• List of available icons
• Wizard data not replacing arguments correctly?
• PropertyProcessor problem