Upgrading MVC4 to MVC5 and WebAPI1 to WebAPI2 – MEF – DotNetOpenAuth

Originally Written 20 June 2014

So, if you have found this blog post as you are going through this process and have hit numerous brick walls I’m afraid I’ve got no answers.

I wasted 3 days on this process and by 3pm on the 3rd day I simply gave up and reverted my working copy back to MVC4.

it seems there are a number of breaking changes between MVC4 and MVC5 that just simply are not being talked about much and since I have a workload of 10 people at the moment I simply do not have spare capacity to sit down for days on end poking the framework to get it to work for me.

The security model in MVC5 is different meaning that DotNetOpenAuth is no longer working, which means Andrew Arrnott who WAS the lead (yes you read that right – WAS) had to issue a quick fix to DNOA so that it worked – DotNetOpenAuth MVC 5 extensions.

On top of all that faffing around with DNOA I found that I had yet more issues with the Microsoft.Bcl.Build stuff which is frankly a joke. Also the Attribute routing implementation that is now built in to WebAPI isn’t a patch on AttributeRouting. Crap.

Then for some reason which I could never get to the bottom of (hence the rolling back to MVC4) all my MEF code in my WebAPI solution simply stopped working. I have absolutely no idea why but all of a sudden my custom controller factory was simply bypassed by the whole pipeline meaning that anything marked as an import was left null. There is nothing talking about this online and I tried all mannor of code changes to try and figure out the problem and get it working but nothing fixed it. I have two open StackOverflow questions which I will keep an eye on:



So basically, upgrade at your peril, it may just eat through your time like a bastard, I gave up … for now.

UPDATE 30 June 2015

Amazingly this is almost a year to the date of the original post.  Again I have tried to migrate my MVC WebAPI and MVC Site over to the newer versions and again I have utterly failed and rolled it all back.  So many breaking changes and libraries that I’m dependent on that still just won’t play nicely.  I’ve wasted so much time and effort on getting this done that I have simply not got the time to carry on trying to push forwards with it all.

I have absolutely fallen out of love with DotNetOpenAuth.  It is a hugely over complicated library and I cannot wait to ditch it for something better.  It works for now and will have to do but I am not happy about how this library is put together.  It is hugely brittle and even the build process in the source code is horribly complex.

When will package authors realise that the more trickery you put into something the harder and harder it gets to support and for others to pick up and run with.  Not impressed.  Version 5 of this library has been in development since 2013 and is still only in an alpha state.  I’m going to move away from using this package at the first available opportunity I get.

I’ve also come to the conclusion that I’m not going to migrate to a newer version of MVC I’m going to build the MVC6 or maybe even MVC7 version from the ground up to make the most of the new features of the chosen replacement platform.  It seems the changes in 6 are profoundly deep, ASP.NET 5 doesn’t even support Web Forms for instance.  THAT is a huge development on its own.

Anyway, for anyone reading this and planning on doing the migration, good luck!


  1. maddy · April 7, 2015 Reply

    please check http://mvc4all.com/mvc/category/mvctutorial/ for more details on this thread….might be useful

  2. jammer · April 7, 2015 Reply

    Thanks for that. It turned out to be an issue with DotNetOpenAuth but I’ll look over this and see if there are any tips for when I do migrate to MVC5. Thanks.

Leave a Reply

Your email address will not be published.


This site uses Akismet to reduce spam. Learn how your comment data is processed.