CodeSmith Community
Your Code. Your Way. Faster!

Compiler errors

Latest post 02-04-2008 7:21 AM by Pauls1927. 3 replies.
  • 01-14-2008 7:56 AM

    • Pauls1927
    • Not Ranked
    • Joined on 01-14-2008
    • Posts 3
    • Points 45

    Compiler errors

     

    I have written a template to generate Stored Procedures and it runs fine in Codesmith Studio.

    I have made a C# application which runs this template based on user input. In this application I use the CodeTemplateCompiler to compile the template but here it fails with errors refering til line and column numbers. How can I find the source line referred by the error messages - the template uses an include file. I was hoping to find a combined source so I could just go to the line containing the error.

     Regards

    Paul S

     

    • Post Points: 35
  • 01-18-2008 10:19 AM In reply to

    • shannon
    • Top 50 Contributor
    • Joined on 03-06-2007
    • Posts 72
    • Points 4,975

    Re: Compiler errors

    Have you takan a look at the Errors property or the GeneratedAssemblySourceCode the CodeTemplateCompiler object?

    • Post Points: 35
  • 02-04-2008 7:03 AM In reply to

    • Pauls1927
    • Not Ranked
    • Joined on 01-14-2008
    • Posts 3
    • Points 45

    Re: Compiler errors

    Yes 

     -  compiler.ErrorsIdea {c:\Users\pas\AppData\Local\Temp\f2mkscrm.0.cs(717,2) : error CS1525: Invalid expression term '='} System.CodeDom.Compiler.CompilerError
      Column 2 int
      ErrorNumber "CS1525" string
      ErrorText "Invalid expression term '='" string
      FileName "c:\\Users\\pas\\AppData\\Local\\Temp\\f2mkscrm.0.cs" string
      IsWarning false bool
      Line 717 int
    +  Non-Public members  

    I have tried to locate the temp file without luck - the line no. 717 is not in my template - only contains 300 lines - it includes another file with 1000 lines, byt going into that one at the specified line no made no sense either.

    So how can I get closer to finding the error ?

     Thanks Paul S

     

    • Post Points: 5
  • 02-04-2008 7:21 AM In reply to

    • Pauls1927
    • Not Ranked
    • Joined on 01-14-2008
    • Posts 3
    • Points 45

    Re: Compiler errors

    Big Smile Got it !

    Reading your answer a couple of more times made me check the GeneratedAssemblySourceCode - and there it was - thanks a lot for your help Yes

     Regards Paul S

    • Post Points: 5
Page 1 of 1 (4 items) | RSS
Copyright © 2008 CodeSmith Tools, LLC
Powered by Community Server (Commercial Edition), by Telligent Systems