VS2010禁用T4模板验证

发布于 2024-10-08 12:05:10 字数 374 浏览 0 评论 0原文

如何禁用 T4 模板验证。 VS2010 正在验证我的 T4 模板,其中包含“#”(尖锐字符)的部分。

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

该错误是无稽之谈。我什至可以从模板生成代码,但无法运行我的项目,因为我的模板抛出错误 CS1040。

安装 Visual t4 后出现此错误,即使从扩展管理器卸载也不起作用。安装 Visual T4 for VS2010 给我带来了亚音速模板的问题。禁用和卸载也没有帮助。我很失望。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

记忆消瘦 2024-10-15 12:05:55

T4 模板的构建操作已更改。当您将文件从一个项目复制到另一个项目或意外在属性中更改它时,可能会发生这种情况。

解决该问题的步骤:

  • 右键单击该文件并选择属性 (Alt+Enter)。
  • 选择构建操作并将其更改为默认值
  • 保存项目并重建。

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.
甜心 2024-10-15 12:05:52

由于某些原因,T4 模板的“构建操作”更改为“编译”,只需将其设置回“内容”

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文