有没有办法在网站项目中使用 T4 模板?
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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
最简单的方法是将类库项目添加到您的解决方案中,然后让 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
我相信他们需要一个项目来运行。我把它归咎于微软......所以也许添加一个库项目会起作用。不过,不知道运行时连接字符串是否应该放在 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.