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

The Barn site is live!(3rd April 2012)

For the last few weeks I've been pulling together the concept of 'The Barn'. Ostensibly it's a company blog, but to me it's a bit nicer than that. …

Barcamp Bournemouth 4(7th March 2012)

Having made the trip twice before I was looking forward to Barcamp Bournemouth. It's probably my favourite small event. Partly because it's so close, partly because it's a great venue but mainly because there's always something interesting and new (at least new to me) going on.…

WP7 vs iPhone(16th February 2012)

Ok so if you follow me on twitter you may know that towards the end of last year I took part in 'Alphalabs'. Organised by onedotzero this was a competition aimed at encouraging developers and artists to work together on the Lumia 800 platform.…

Cargowire has a new design(5th February 2012)

Apparently doodling can be good for you. Although when I do it, it's not so good for Ed Merritt.…

Why you should try to be a middle class developer(16th August 2011)

You may not know this but this blog has been xml based since its inception (in fact there's a longstanding, not yet achieved, task to 'replace' it with a 'better' persistant storage mechanism -- clearly I must agree then, that the perfect is the enemy of the good). But anyway... don't worry. I'm not about to do anotherblogaboutxml.