我是t4的新手.
我想生成cs文件的代码.我创建了一个新的tt文件.
<#@ template debug="false" hostspecific="false" language="C#" #>
<#@ output extension=".cs" #>
class IOperation {
<#
OperationSection section = null;
#>
}
Run Code Online (Sandbox Code Playgroud)
OperationSection是同一程序集中的一个类.我假设我应该使用"using"关键字.
我是怎么做到的 现在我收到一个错误
错误2编译转换:找不到类型或命名空间名称'OperationSection'(您是否缺少using指令或程序集引用?)
谢谢
使用import指令:
<#@ import namespace="YourNamespace" #>
Run Code Online (Sandbox Code Playgroud)
此外,您可能需要添加一个assembly指令来引用定义类的程序集:
<#@ assembly name="$(SolutionDir)\MyProject\bin\Debug\SomeLibrary.Dll" #>
Run Code Online (Sandbox Code Playgroud)