我正在尝试在VS2008中的VB.NET中的T4模板中使用PGK.Extensions,但出现以下错误:
RemoveAllSpecialCharacters不是string的成员。
我的T4头文件:
<#@ template language="VB" hostspecific="false" debug="true" inherits="Microsoft.VisualStudio.TextTemplating.VSHost.ModelingTextTransformation" #>
<#@ output extension="vb" #>
<#@ assembly name="PGK.Extensions.dll" #> // the dll is found
<#@ import namespace="StringExtensions" #> //Try with and without namespace
在块代码中使用扩展:
<#
Me.WriteLine(item.Name.RemoveAllSpecialCharacters.ToUpper)
#>
RemoveAllSpecialCharacters是PGK.Extensions.dll中的字符串扩展方法。
有人能帮忙吗?
编辑:
好的,就是这样:
<#@ template language="VBv3.5" ...
但是这会破坏DevArt T4编辑器在VS2008插件中的智能感知和语法高亮。建议改用Tangible T4编辑器。