I want a template which somehow accepts a class_name
property and creates a class, name of which is the value of class_name
Ideally, I should be able to execute my template inside MyClass.cs
containing definition for public partial class MyClass
, and that would set class_name
to MyClass
This template
<#@ template debug="false" hostspecific="false" language="C#" #>
<#@ assembly name="System.Core" #>
<#@ import namespace="System.Linq" #>
<#@ import namespace="System.Text" #>
<#@ import namespace="System.Collections.Generic" #>
<#@ output extension=".cs" #>
public partial class <#=class_name #>
{
}
produces an error:
Error 1 Compiling transformation: The name 'class_name' does not exist in the current context
How do I put a definition of a class_name
into it?