26

I'm aware of manual guides to upgrade from 3 to 4 like this one: http://www.dotnetexpertguide.com/2011/12/upgrade-aspnet-mvc-3-project-to-mvc-4.html

The guides vary in their details which clearly signals danger. Is there a tool that handles the transition from an MVC3 project to MVC4? This would implicitly mean migrating from .Net 4 to .Net 4.5, which does have some significant implications in terms of all the namespace redirects Microsoft added between the 2 versions.

I'm also aware of manual guides that basically say to give up on upgrading and instead just create a new project and port things over piece by piece into the new project. This has a lot of obvious opportunities for small mistakes to create big problems.

So, a tool that's been tested I can count on to not make a silly mistake like I might would really help here. Does that exist? There's a tool to get from MVC2 to 3, so not finding one for 3 to 4 surprised me.

Background for why I'd like to upgrade: we have several newer projects on .Net 4.5 MVC4, and an important older project on .Net 4 MVC3 (with some .Net 2 and MVC 2 mixed in...), and the more our shared libraries move forward the more that old project struggles. We can freeze the last working on the shared libraries obviously, or fork them and maintain 2 versions... obviously neither of these is very appealing. I'd prefer to just update the toolset on the older project and bring everything into parity.

3
  • 3
    No tool, but also check my write-up after migrating from 4.0 / MVC 3 to 4.5 / MVC 4 - ivanz.com/2012/08/20/… Commented Sep 29, 2012 at 20:43
  • Thanks that did the trick. So to clarify, I had to change my Target Framework on all Projects to .Net 4.5, then uninstall Entity Framework, then install it again, then finally upgrade MVC 3 to 4 as described in the link I included. That did the trick. At last: Dictionaries in JSON serializing over POST. Commented Dec 29, 2012 at 1:34
  • Reported the bug - github.com/NandipMakwana/UpgradeMvc3ToMvc4/issues/1 Commented Feb 20, 2013 at 8:12

1 Answer 1

37

An auto-upgrade now exists.

Check this out: http://www.dotnetexpertguide.com/2013/02/aspnet-mvc-auto-upgrade-mvc-3-to-mvc-4-application.html

It is a Nuget Package called UpgradeMvc3ToMvc4

Sign up to request clarification or add additional context in comments.

8 Comments

Pretty cool - did you write this? It does some odd things - for example it adds controlRenderingCompatibilityVersion="4.0" to the pages tag in Web.Config, which seems unnecessary and potentially a problem in the future. However it does work, and saved me a bunch of time - thank you.
@ChrisMoschini - No, I am not the author, but i am glad you found it useful!
@IvanZlatev If you mean <ProjectGuid> in the .csproj file, no, these aren't changed (but don't need to change) - which GUIDs are you referring to?
@ChrisMoschini Doesn't the ASP.NET MVC 4 project require an updated Project GUID for it to be picked up as an MVC 4 project (rather than MVC 3) by the IDE for the purpose of templates (file/items) and others? {E53F8FEA-EAE0-44A6-8774-FFD645390401} to {E3E379DF-F4C6-4180-9B81-6769533ABE47}.
@IvanZlatev Good eye! It does not do this, and that is indeed a bug of this NuGet package - the MVC3 project I upgraded with this tool still expects to add MVC3 Layouts, not MVC4 Layouts (though the distinction is very minor).
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.