views:

457

answers:

5

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.

+1  A: 

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 http://stackoverflow.com/questions/786734/subsonic-asp-net-mvc-sample-in-visual-web-developer-express

mcintyre321
I'm using VS2008 Standard with SP1.There was no CustomTool in the properties for the .tt files so no context menu right-click option to run a tool.If I manually add TextTemplatingFileGenerator as the custom tool the context menu offers it when i right-click, but then VS barfs with "Cannot find custom tool 'TextTemplatingFileGenerator' on this system".So, now I'm another tiny step closer. All I need now is a clue to where i get and install the custom tool. First stop is going to be my VS install discs...
A: 

I'm truly screwed.

Vista (Ultimate) spends 25 minutes thrashing away at the install disc in the DVD drive and then declares "Unable to install Visual Studio 2008 SP1".

I guess I've installed something that's interfering not only with the way VS2008 works, but also with the way the installer works so it can't be repaired. Bugger!

I dug out an old backup hard disc image, from the days when I was still using XP Pro. That has VS2008 installed, but I didn't want to roll back Vista, so loaded it onto an old PC (eventually).

Now the .tt files are magically recognised and VS processes them and generates the C# code - yayy!

But it's not all good news...

The old PC is a donkey. Processing the .tt files takes an age, and everything else is so slow too. I need to get my main Vista machine back to full working, but at least I can see now how the process works.

Next quibble is the mismatch between the screencast and what comes down in the .zip file...

A: 

be sure that your solution/project is an "asp.net mvc" or "ClassLibrary" in order the VS to recognize the .tt

No Body
A: 

See http://stackoverflow.com/questions/267323/cant-drag-files-to-solution-explorer/1932022#1932022

basically, you can't drag files into Visual Studio if you're running it as Administrator. Since Windows Explorer can't be run as Administrator, the only way is to not run Visual STudio as an admin, That will allow you to drag files into Visual STudio.

silverCORE
A: 

I have the same frustration with Windows 7 and VS 2010 (running as Admin). No kabob for me either. I've tried running custom tool which also does Jack Diddly. My proj is class library.

SteveCav