TerrorBight
TerrorBight

Reputation: 313

Phased migration - running ASP.NET 4 alongside ASP.NET 5

We have MVC ASP.NET Web Applications written within the ASP.NET 4.* scope that we would like to phase across to ASP.NET 5. While we transition (as well as client-side JavaScript scripts/libraries, CSS, etc) we'd like the old app (which obviously contains Views, Controllers, Helpers, Utilities, Attributes, etc) to co-exist in an MVC/Web-Application ASP.NET 5 project, with the new (ASP.NET 5) codebase.

Firstly is this possible with minimal changes ? I have been doing some testing and a lot of reading - for the client-side libraries I should be able to handle the co-existence by copying the existing content into the wwwroot area via Gulp. My question is mostly around the server-side artifacts - for example I am using a framework (as specified in project.json) of "dnx46" (which seems to be the most appropriate for this purpose), but I am getting a number of conflicts (around missing assemblies) around simple things like Project references, ActionFilterAttribute & AuthorizeAttribute [eg. The type or namespace name 'AuthorizeAttribute' does not exist in the namespace 'System.Web.Mvc' (are you missing an assembly reference?)] (because they no longer exist in the System.Web.Mvc namespace), HttpContextBase, security (OWIN, etc) etc - note that I'm aware of including References which are reflected within the project.json file (and some that finish up inside the appropriate 'wrap' folder location)

If there is a preferred approach - some possibilities are

Any ideas would be greatly appreciated.

Upvotes: 0

Views: 80

Answers (1)

Janshair Khan
Janshair Khan

Reputation: 2687

I don't know that how your MVC 4 project is structured, I would prefer to create it from scratch using Blank ASP.NET 5 Template targeting dnx451. The thing I don't understand is previous .NET stuff like Authorize attribute are not found as they are available and I'm using it. Here are some stuff that might be help to you while migrating:-

  1. Your EF Context and security classes should be considered as middlewares in ASP.NET 5 and should be configured in Startup.cs class which is not found in MVC 4.
  2. Put all your CSS\JS files in wwwroot and make a reference _Layout.cshtml as root as normally (use gulp task runner for better performance.)
  3. Must target dnx451, because dnx50 does not contain all of the libraries and it is about immensely in ASP.NET Core RC2 and RTM. (If you can't wait for RC 2).
  4. If you're using Identity for Authorization, note that there is now a big change in Authorization Policy as can be found Here

It is a little bit difficult but it will optimize your team working and will make your project flow faster than before.

Upvotes: 1

Related Questions