17

I was developing a C# T4 pre-processed template, under Visual Studio 2010, when I have got the following compilaton error:

A template containing a class feature must end with a class feature

1
  • You really should post your solution as a stand-alone answer . It helped me a lot, thanks! However, I can have as many newline characters at the end as I wish, though. Only spaces seem to cause the issue for me.
    – pbalaga
    Commented Aug 23, 2012 at 15:04

1 Answer 1

40

The error is caused by an invisible space after the last #>

It is also important to bear in mind, that invisible spaces may cause other hard-to-understand compile-errors.

If you want to see a bigger picture, just look at following links:

Now that you are aware how harmfull invisible spaces can be when dealing with Text Templates, my advice is: Make them visible. If you don't know how to do it, see Jeef Widmer's blog

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.