Sunday, 29 March 2009

Missing Entity Framework Templates and Visual Studio 2008

VS2008LogoWanting to play with the different technologies on my “Tech ToDo” and following on from my first Tech Day with NHibernate, I wanted to play with Microsoft’s Entity Framework (EF). EF is (to my understanding) a beefed up version of LINQ to SQL.

So, I happily go ahead and download the .NET Framework 3.5 SP1, install and eagerly run off to add my EF data model to my project.. But I can’t, there is no item for it in the templates. The tutorial (actually an MVC one) said there should be, the readme said there should be, but there wasn’t.

Steps Attempted (to no avail)

Following a tweet from @JeremySkinner, I checked that the assemblies (System.Data.Entity*) had installed OK to the reference assemblies folder (C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5) – they had. Next please!

Following on from that, I then thought about the version of Visual Studio I am running.. Mine is actually under the DreamSpark license as I am currently studying with a MS partner, but I got it wayyyy back when 2008 was still in beta. I thought maybe that was it. So I run off to the DreamSpark web site and download a new version and key. I then did a repair install of .NET 3.5 SP1, and again, no dice. Next please!

I then think, maybe the install is just crazy. So I totally uninstall VS2008 and all related components, and reinstall from the new disk downloaded from DreamSpark. Guess what? No dice. And to top it off, I could no longer create MVC projects as it was failing with “project type is not supported by this installation”. I was actually able to resolve this by running “devenv /setup” from the VS command prompt. At this point we are back at square one.

Stumbling Across the Resolution

At this point, I am getting pretty pissed. I figure “screw it”, I will just check out LINQ to SQL instead. So I begin cobbling together a site using LINQ to SQL instead, only to get an error when I try adding my database – oh yeah, I uninstalled MS SQL Server Express 2005 earlier.. No problem, I wanted to upgrade to SQL Server Express 2008 anyway! I begin the install, and fail the pre-requisite check because I don’t have VS2008 SP1 installed..

I thought this was odd, as I was convinced this was installed as an update - oh well, I need it anyway, so I downloaded and installed that. Then I thought “does the EF need VS SP1 too?

NOTE: It never failed in the install and never asked for it.

I then went back and did a repair install of .NET Framework SP1 and then fired up VS again.. And guess what had appeared..

image

Happy face :)

The Moral of the Story..

Always make sure you have ALL the updated kit.. It can be hard to keep track of it all when “waves” are coming out (e.g. this “SP1” wave across the .NET 3.5/2008 family of products).

I thought I would share this slight revelation since I have noticed via Google I am not alone!

2 comments:

Anonymous said...

Well.... that didn't help here.

Moral of the Story:
Never forget its Microsoft ! (i.e. why they didn't provide separate EF templates to be downloaded...)

Rob The Geek said...

Anon,

Having all the relevant kit (i.e. SP1) installed does fix the issue. I have been completely unable to replicate since this.

The moral of the story is actually "the installer doesn't do a proper pre-requisite check"..