T4工具箱 - 混合类功能和语句块
我是一个T4新手试图使用T4工具箱根据这个答案生成F#代码,但似乎类功能块不能与语句块混合使用。这是我的代码:
<#@ template language="C#" hostspecific="True" debug="True" #>
<#@ output extension="txt" #>
<#@ include file="T4Toolbox.tt" #>
<#
FSharpTemplate template = new FSharpTemplate();
template.Output.Project = @"..Library1Library1.fsproj";
template.Output.File = "Module2.fs";
template.Render();
#>
<#+
class FSharpTemplate: Template
{
public override string TransformText()
{
#>
module Module2
<# for (int i = 0; i < 10; i++) { #>
<#= i #>
<# } #>
<#+
return this.GenerationEnvironment.ToString();
}
}
#>
我收到这个错误:
声明后不能出现
模板中的第一类功能。
只有样板,表达式和
之后允许其他类功能
第一类功能块。
那么......我怎样才能重写模板来实现这个目标呢?
没有找到相关结果
已邀请:
3 个回复
遣莫捅炭
授巨
诉嘎归亮