有没有办法在网站项目中使用 T4 模板?

发布于 2024-08-12 06:33:30 字数 134 浏览 9 评论 0原文

T4模板可以用在网站项目中吗?

或者更具体地说,Subsonic 可以在网站项目中使用吗?

我可以在 Web 应用程序项目中运行 .tt 文件,但它在网站项目中不会执行任何操作。我猜他们需要一个解决方案/项目环境才能运行?

Can T4 templates be used in a web site project?

Or more specifically, can Subsonic be used in a web site project?

I can run the .tt files in a web application project but it does not nothing on a web site project. I guess they need a solution/project environment in order to run?

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

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

发布评论

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

评论(2

少女七分熟 2024-08-19 06:33:30

最简单的方法是将类库项目添加到您的解决方案中,然后让 SubSonic 在其中进行生成。然后,您可以从您的网站项目引用类库。

编辑为了澄清,您需要在库项目中使用 app.config 以及用于生成的连接字符串,并且您需要在 web.config 中使用连接字符串用于运行时数据库连接

The easiest way to do this is to add a class library project to your solution and then have SubSonic do it's generation inside that. You can then reference the class library from your website project.

Edit To clarify you'll need an app.config in the library project with your connectionstring for gernation and you'll need a connectionstring in your web.config for runtime database connection

巴黎盛开的樱花 2024-08-19 06:33:30

我相信他们需要一个项目来运行。我把它归咎于微软......所以也许添加一个库项目会起作用。不过,不知道运行时连接字符串是否应该放在 web.config 或 dll 的配置中。

I believe they need a project to run. I blame it on microsoft.... so perhaps adding a lib project would work. Don't know if the runtime connection string should go in the web.config or the dll's config, though.

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