Craig Rowe

Techlead / Developer

4th June 2009

MVC is finally installed on my home PC!

For those intrigued by my twitter activity tonight (OK, it was just Dave and I've already told him anyway), but still, I ambiguously cried out:

OMFG really was it that simple? I hate everything right now

http://twitter.com/cargowire/status/2034102008

As a .NET developer who likes to complain about webforms I was pretty keen to get to grips with the MVC framework when it was available. So, so I could play about with it at leisure I began a two step process:

  • Step 1: Install on work laptop - Done in seconds
  • Step 2: Install on home PC - Massive Fail

Thus began a process of occasionally coming back to it, searching for a solution, failing to find it then giving up again for a bit.

The majority of sources refer to uninstalling VS addins, ensuring you have 3.5 SP1, ensuring you uninstall any betas etc. I tried these things and failed... Eventually it was this post by Phil Haack that was the spur that led me to the solution. As you'll see I even got to the point of commenting on the poor mans blog.

Several posts, including a response to another request I'd made on the asp.net forums, were even suggesting I reinstall everything, including windows, and start from scratch. Now I really didn't want to do that, and to be honest, thought that should never be necessary to get something to install (imagine having to do that for every installation you undertake on your system).

Having attempted some of the ngen related activities proposed by Phil Haack without success I dug a little deeper into the log I was getting:

ExecNetFx: Error compiling System.Data.Entity, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089: Could not find or load a type. (Exception from HRESULT: 0x80131522)

Now without really having any prior experience with these kind of problems I was perhaps naively believing that the MVC install would have catered for dependencies and that if I was getting this error clearly there was some kind of conflict or problem (the whole uninstall-reinstall stuff scenario). This was reinforced by my attempts to run ngen ExecuteQueuedItems and ngen Update (and even an ngen delete at one point) all failing. However tonight I seemingly lucked upon the answer.

Having already previously identified I had the System.Data.Entity library sitting in the GAC (C:\Windows\Assembly) and the dll itself in C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\System.Data.Entity.dll I was still looking for some other kind of problem. However I tried, virtually on the off chance, to directly ngen the dll myself rather than rely on the MVC installer to do everything for me.

            C:\Windows\Framework\v2.0.50727\ngen install "C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\System.Data.Entity.dll"
          

Immediately after doing this I started an MVC install - it worked.

And so retrospectively I was annoyed as the action I took in relation to the error I was seeing seems pretty obvious!

Anyway it's all over, I'm off to reinstall my addins. The nice thing about it though was I ended up getting a response from an asp.net team member on forums.asp.net, which reminded me how much I like the openness of Microsofts team i.e. bloggers, forum posters etc.

To save the jump heres some interesting info from Jacques:

In the Beta we only added support to the installer to GAC the assemblies, but starting with the RCs we began to create native images as well.

When the MVC installer runs it automatically performs an ngen update and compiles any assembly that might be deemed to be out of date. Any failure during the ngen process is reported back and the installation will initiate a rollback.

Jacques Eloff

Further Reading for the Interested Reader

  • Global Assembly Cache - Shared store for libraries
  • Ngen.exe - Generates native processor specific machine code to avoid JITing the original assembly


Other Recent Posts

DevSouthCoast GameJam 2013(15th September 2013)

Making games over a weekend... competitively... and we chose a dead technology... why the hell not! …

NodeCopter Southampton 2013(11th August 2013)

Hack Days are awesome. How could they not be? you get to make stuff with like minded people with no bosses, no client deadlines, no point but the love of it. …

Joining Dootrix(24th November 2011)

It's been a while since I posted. I'd like to say that's because a lot's been going on. In reality I got lazy and now I just happen to have something to write about that can make it sound like a lot has been going on.…

.NET Web Development, you know you want to... (4th July 2012)

My first smashing coding article is now available! It's main aim is to convince people that .NET isn't all bad.…

Should everyone learn to code?(4th June 2012)

It's not often I write opinion pieces but the whole 'learn to code' thing seems to have been building since the beginning of the year. It's time to add my voice to the squabble. …