t4s#arp-architecturenorthwindsharp-architecture

T4 for Sharp Architecture/Northwind Problem


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.

Error 1 Compiling transformation: Invalid token 'this' in class, struct, or interface member declaration file:BaseTemplate.tt

Error 2 Compiling transformation: Class, struct, or interface method must have a return type file:BaseTemplate.tt

Error 3 Compiling transformation: Type expected file: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?

Thanks a lot for your time, PK


Solution

  • I have received this using other T4 templates. The problem ends up being spaces at the end of the file (following the very last '#>' ).

    Open your .tt file in VS, CTRL+END, make sure all spaces are removed following the last #>

     string someMethod()
     {
         //some code
        return "someValue";
     }
     #>
    

    Props go to a post by Cheverton: http://social.msdn.microsoft.com/Forums/en-SG/vsx/thread/cd1217c1-39b0-4799-86a2-2449e21a8544