Use in T4.

Mar 28, 2012 at 8:48 AM
Edited Mar 28, 2012 at 8:49 AM

I'm trying to use PGK.Extensions in a T4 template in VS2008 for VB.NET and I get:

RemoveAllSpecialCharacters is not a member of string.

My T4 headers:

<#@ 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

Use of extension in block code:


RemoveAllSpecialCharacters is a string extension method from PGK.Extensions.dll.

Can anybody help me?

Mar 29, 2012 at 7:51 PM

StringExtensions is the class name, not a namespace. You actually do not need to import anything in regular code. I'm not used to VB anymore. Don't you need brackets after calling a method like this: