views:

111

answers:

2

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?

+1  A: 

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

Adam
Thanks! I will try that.
metanaito
+1  A: 

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.

Andrew Backer
Thanks for the info. I didn't think about doing that.
metanaito