我有各种各样的 hell 让 Visual Studio 2010 编译我的 T4 模板。我很确定这个相同的模板在 2008 年有效,但我现在无法确认。我确信它适用于 MonoDevelop。
无论如何,这是我模板的标题:
<#@ template language="C#v3.5" hostspecific="true" #>
<#@ output extension="cs" #>
<#@ assembly name=“System.Core” #>
<#@ import namespace="System.IO" #>
<#@ import namespace="System.Text" #>
<#@ import namespace="System.Collections.Generic" #>
<#@ import namespace="System" #>
<#@ import namespace="System.Linq" #>
Visual Studio 2010 提示第一行,即模板指令:
A directive was specified in the wrong format. The transformation will not be run. Please specify the directive in the format <#@ name [parameterName="parameterValue"]* #>
为什么这不能按预期工作?
最佳答案
我的问题是我复制并粘贴了 assembly
指令,它使用了 “”
而不是 ""
另外,我发现它作为错误给出的行号基本上毫无意义。
关于.net - 简单的 T4 模板在 Visual Studio 2010 中不起作用,但在 MonoDevelop 中起作用吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11442667/