Visual-studio – How to persuade VS2008 to run .tt template files

subsonic3templatesvisual-studio-2008

Following the words-of-one-syllable walkthrough should get my demo app working, right? But I fell down twice so far and I'm only up to step 4 in the 5 step process 🙁

1 Create a new project in Visual Studio 2008

Done that, yayy!

2 Add a connection string to your Web/App.config, give it a name, and point it to a valid database

Done that, yayy!

3 Grab the folder containing the T4 templates (the "tt" extensions) and locate the one that named "_Settings". Open it up in Notepad and set the value for "ConnectionStringName" to the name of the connection string you just made.

Whoops. There isn't one named "_Settings.tt" – there's one named "Settings.ttinclude" – is that the one I need to edit? Do I need to change the name too?

So I take a punt and edit it to use my connection string name and database name and namespace name, and save it as "_Settings.tt"

4 Drop the folder with the T4 templates into your project. Visual Studio 2008 will see these and execute the template code, creating your classes

I drag the folder into my VS2008 ConsoleApplication1 project and nothing happens.

All the docs and everything suggests that VS2008 will magically understand the .tt extension and immediately sprig in to action to do some serious work on my behalf.

I'd wait, but Hell might freeze over, so I go searching for clues. Nope, everybody thinks it's automatic, no-touch, magic.

5 You're done – go have a Kabob.

No kebab for me. I'm not done. I need help.

Best Answer

right click and "run custom tool"

Are you using express? I read a post this morning moaning about using the t4s in subsonic with VS expres... instrunction on configuring it in here SubSonic ASP.NET MVC sample in Visual Web Developer Express