I have a templating system that looks similar to old-style ASP code. I run this through a class that rewrites the entire thing into C# source code, compiles, and finally executes it.
What I'm wondering is if there is some kind of #pragma-like directive I can sprinkle the generated C# code with that will make compile errors match the line numbers in my template file?
For instance, let's say I have this first and only line in my template code:
Object o = datta; // should be data, compiler error
but then in order to compile this I must add a namespace, a class, a method, and some boiler-plate code to it, so this line above, which is line #1 in my template file, actually ends up being line #17 (random number, just for illustrative purposes) in the C# code. The compiler error will naturally flag my error as being on line #17, and not on line #1.
I remember from another programming language I've used before (though I can't remember which one) that it had a directive that I could add, which would make error line numbers line up.
Is there any such thing in C# 3.5?