Changing mvc projects into mvc5 area

790 views Asked by At

I have for some time created a few mvc websites. The other day my super suggested I put them all into one solution as they - more or less - is related to each other. So I have come a long way with making the projects work more or less on their own.

Yesterday I hit a little bump where I am to put one project where you log in in order to register data. I have moved the login code to the first website (front?) and now that works. It was when I wanted to create the link (ActionLink) to link to the registration project, I started doing research on moving/transforming/changing a project into an area in mvc5.

So my question: Has anyone moved/transformed/changed a mvc5 (or 4 or 3) project into a mvc5 area? Is there something to worry about when doing this?

1

There are 1 answers

0
Slicksim On

There are several things to consider when merging a project.

  1. Routes and namespacing - If you controllers that have the same names in multiple areas, you will need to add a namespace entry to the route entries. Details here http://haacked.com/archive/2010/01/12/ambiguous-controller-names.aspx/
    1. Make sure you have an area registration file that sets up each area. i usually add 1 area, then copy it's registration file and rename appropriately
    2. Script and css dependencies - make sure that you get all those added to the root, seperate them in area folders if you like, then add them in at the correct area by using a section in your layout for dependencies
    3. Adding a hyperlink between areas now needs to include the area name if you have conflicting controllers , you can check these answers How to specify an area name in an action link?

Think that about covers most things I have found when doing areas

Si