VS2010 Disable T4 Template Validation
Asked Answered
A

2

9

How do you disable T4 Template validation . VS2010 is validating my T4 Template just now on ever part that has '#' (the sharp character).

error CS1040: Preprocessor directives must appear as the first non-whitespace character on a line

The error is nonsense. I can even generate code from my templates but I can't run my project because my templates throw error CS1040.

I get this error after installing visual t4, even uninstalling from extensions manager won't work. Installing Visual T4 for VS2010 gave me problems with subsonic templates. disabling and uninstalling didn't help either. I am so disappointed.

Ac answered 22/12, 2010 at 14:0 Comment(0)
A
23

For some reasons "Build Action" for T4 templates changed to 'compile' just set it back to 'content'

Ac answered 24/12, 2010 at 17:20 Comment(0)
V
1

The build action of your T4 template has changed. This may happen when you have copied your files from one project to another, or changed it in the properties by accident.

Steps to resolve it:

  • Right-click the file and choose Properties (Alt+Enter).
  • Select Build Action and change it to the default value None.
  • Save the project and rebuild.
Vingtetun answered 6/4, 2014 at 10:9 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.