T4适用于Sharp Architecture/Northwind问题 [英] T4 for Sharp Architecture/Northwind Problem
问题描述
我刚刚下载了Sharparchitecture/Northwind,并且我正在尝试 搭上脚手架上班.除了添加外,我什么都没改变 缺少对该类库的引用.我试着跑 ScaffoldingGeneratorCommand.tt,我遇到了以下3个错误.
I have just downloaded sharparchitecture/Northwind and i'm trying to get crud scaffolding to work. I have changed nothing except adding missing reference to this class library. I try to run ScaffoldingGeneratorCommand.tt and I hit following 3 errors.
错误1编译转换:中的无效令牌'this' 班级, 结构或接口成员声明文件:BaseTemplate.tt
Error 1 Compiling transformation: Invalid token 'this' in class, struct, or interface member declaration file:BaseTemplate.tt
错误2编译转换:类,结构或接口 方法 必须具有返回类型文件:BaseTemplate.tt
Error 2 Compiling transformation: Class, struct, or interface method must have a return type file:BaseTemplate.tt
错误3编译转换:输入所需文件:BaseTemplate.tt
Error 3 Compiling transformation: Type expected file:BaseTemplate.tt
编译器说它们出现在BaseTemplate.tt的第一行中,但是我 别 认为这是真正的原因.
Compiler says they occur in the first line of BaseTemplate.tt but i don't think that is the true reason.
有人遇到过这个问题吗? 您有什么想法可以解决吗?
Has anybody had this problem? Do you have any idea what can i do to fix it?
非常感谢您的宝贵时间, PK
Thanks a lot for your time, PK
推荐答案
我已经使用其他T4模板接收了此信息.问题最终在文件末尾出现空格(最后一个'#>'之后).
I have received this using other T4 templates. The problem ends up being spaces at the end of the file (following the very last '#>' ).
在VS,CTRL + END中打开.tt文件,确保在最后一个#>之后删除所有空格.
Open your .tt file in VS, CTRL+END, make sure all spaces are removed following the last #>
string someMethod()
{
//some code
return "someValue";
}
#>
道具去Cheverton的帖子: http://social.msdn .microsoft.com/Forums/en-SG/vsx/thread/cd1217c1-39b0-4799-86a2-2449e21a8544
Props go to a post by Cheverton: http://social.msdn.microsoft.com/Forums/en-SG/vsx/thread/cd1217c1-39b0-4799-86a2-2449e21a8544
这篇关于T4适用于Sharp Architecture/Northwind问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!