C# t4“;使用;关键词
我是t4新手 我想生成代码到cs文件。 我创建了一个新的tt文件C# t4“;使用;关键词,c#,c#-4.0,t4,C#,C# 4.0,T4,我是t4新手 我想生成代码到cs文件。 我创建了一个新的tt文件 <#@ template debug="false" hostspecific="false" language="C#" #> <#@ output extension=".cs" #> class IOperation { <# OperationSection section = null; #> } 类操作{ } OperationSection是同一程序集中的一个类。 我假
<#@ template debug="false" hostspecific="false" language="C#" #>
<#@ output extension=".cs" #>
class IOperation {
<#
OperationSection section = null;
#>
}
类操作{
}
OperationSection是同一程序集中的一个类。
我假设我应该使用“using”关键字
我怎么做?
现在我收到一个错误
编译转换时出现错误2:找不到类型或命名空间名称“OperationSection”(是否缺少using指令或程序集引用?)
谢谢您需要为中的命名空间操作节添加一个指令。它们看起来像这样:
<#@ import namespace="System" #>
使用指令:
<#@ import namespace="YourNamespace" #>
<#@ assembly name="$(SolutionDir)\MyProject\bin\Debug\SomeLibrary.Dll" #>