c# – T4模板装配指令
我有一个定制的dll,它有一个类,并且(为了简单起见)有一个方法,它将返回一个字符串.
我有一个项目,引用了dll,我想在该项目中使用一个(不是预处理的)T4模板,这个模板称之为方法.我试过这个: <#@ template debug="true" hostspecific="false" language="C#" #> <#@ assembly name="MyDLL.dll" #> <#@ output extension=".cs" #> <# var template = new MyDLL.MyNamespace.MyClass(); this.Write(template.Run()); #> 我收到以下错误:
即使MyClass.Run()只是一个返回“// hello”; 解决方法
好像你的问题:
这是因为这里描述的兼容性破坏: http://weblogs.asp.net/lhunt/archive/2010/05/04/t4-template-error-assembly-directive-cannot-locate-referenced-assembly-in-visual-studio-2010-project.aspx (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |