I use the method in this MSDN link ("Processing Text Templates by using a Custom Host").
This allows me to use T4 programmatically (template can be available in runtime).
But there is a problem that in the template code I can't use
<#@ Import Namespace="System.Xml" #>
I would get message like :
error CS0234: Compiling transformation: The type or namespace name 'Xml' does not exist in the namespace 'System' (are you missing an assembly reference?)
How do I resolve this ?
You need to reference the assembly. The import statement is equivalent to the using statement in C#. You can reference the System.Xml assembly by using:
<#@ assembly name="System.Xml" #>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With