Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it at all possible to migrate ASP.NET ASPX solution to ASP.NET Core 2.0?

I want to migrate my asp.net (UI ASPX pages WebForms) application to ASP.NET Core 2. By some search I found out aspx is not supported in .net core. If this is true(anyone has exact documentation for this?) how should anyone proceed to convert from pure asp.net aspx project to asp.net core 2.0?

I used portable analyzer tool but it is confusing to just give every .dll file and get report which is more confusing.

Please give valid Microsoft document if possible.

like image 479
Bhushan Gholave Avatar asked Mar 19 '18 08:03

Bhushan Gholave


People also ask

Can we migrate .NET framework to .NET Core?

You can migrate your old project to the Core project using the 'dotnet migrate; command, which migrates the project. json and any other files that are required by the web application. The dotnet migrate command will not change your code in any way.

Can I install both .NET Core and .NET framework?

NET Core installations are completely independent from the version of . NET Framework. In fact, you can actually install multiple version of . NET Core side-by-side on the same machine (unlike .

Is .NET Core backwards compatible?

NET Framework 4.5 and later versions are backward-compatible with apps that were built with earlier versions of the . NET Framework. In other words, apps and components built with previous versions will work without modification on the . NET Framework 4.5 and later versions.


1 Answers

It all depends on what you mean by "migrate". As mentioned in the comments to your question, ASP.NET Core does not support web forms so there isn't any way to just automatically convert an a Web Forms website to an ASP.NET Core website.

That said, it is possible to make the migration. I have been working to do just that for a very large web forms based website that I want to convert to ASP.NET Core. If you are serious about making the journey, then here is some info that will probably help you.

The general architecture of ASP.NET Core is based on MVC so it's much more similar to ASP.NET MVC than ASP.NET Web Forms. So you will end up rewriting pretty much all of your UI code using some derivative of a MVC pattern. Instead of master pages you will be using layouts. Instead of server controls you will be using tag helpers. Instead of user controls you will be using partials and view components. Instead of code behinds you will be using controllers and view models. Etc.

It's worth noting that there is still an http context object, request object and response object and they are extremely similar to the analogous objects in web forms. So that helps with the conversion.

Also to make the conversion process easier, you can build an ASP.NET Core web application that targets the full framework. This means that you will have access to most everything you are use to in the full framework except anything in the System.Web namespace. Targeting the Full framework does mean that your new website will only run on windows. But if you can live with that (at least for now) it will make the conversion process easier for you.

If, in your old website, you broke out a bunch of the functionality into class libraries, that will make your life easier. You should be able to bring those class libraries over to the new website unchanged and reference them from the ASP.NET Core website and they will most likely work fine provided they don't reference System.Web. Any code that does reference System.Web will need to be modified to use the new analogous objects or UI approaches.

So in the end, you may be able to bring over your data models, data access code, business objects, and business logic without too much hassle. But you will have to do a total rewrite of your UI related code. That's the journey I'm on and it's not as hard as you might think, at least not once you get up to speed with ASP.NET Core in the first place. Go get `em!

like image 161
RonC Avatar answered Nov 01 '22 14:11

RonC