News

New ASP.NET Core Migration Guidance

Microsoft published new guidance for migrating old ASP.NET applications to the new order, ASP.NET Core.

The guidance comes a few months after the debut of the open source, cross-platform .NET 6, where ASP.NET Core serves as the web-dev framework that usurped just plain old ASP.NET that came with the old, proprietary, Windows-only .NET Framework.

Specifically, the new guidance tackles the "big investment" required for migration, supplying some code-sharing tips that can make the endeavor easier.

"Today we'll share how you can accelerate the migration to ASP.NET Core," said a March 2 post. "There are minor changes you can make today that can make it easier to migrate to ASP.NET Core tomorrow."

Those changes are made in the context of a 10-year-old MVC Music Store app used to demo ASP.NET MVC3, where code is shared for Controllers, Models and Views in the ShoppingCartController.cs file.

The Music Store App
[Click on image for larger view.] The Music Store App (source: Microsoft).

"The ability to share code also includes static content like CSS, JavaScript and images," Microsoft said. "Step-by-step you can build flexibility into your web app today to make your migration to ASP.NET Core easier."

After fleshing out code sharing for the three MVC components, Microsoft provided more tips, some of which can be found in Feb. 18 documentation titled "Migrate from ASP.NET to ASP.NET Core."

  • Upgrade your NuGet packages so you can use netstandard.
  • Change your class libraries to netstandard so you can share code between ASP.NET and ASP.NET Core.
  • Find references to System.Web in your class libraries build interfaces replace them. Use dependency injection so you can easily switch between ASP.NET and ASP.NET Core features.

"If you would like more detailed guidance to migrate the entire ShoppingCartController.cs you can follow a full walkthrough with samples at MvcMusicStoreMigration," Microsoft said. "The walkthrough will also demonstrate how you can run both ASP.NET and ASP.NET Core from the same IIS Application Pool to incrementally migrate your web app one controller at a time."

About the Author

David Ramel is an editor and writer for Converge360.

comments powered by Disqus

Featured

  • Microsoft Ships Stable Versions of OpenAI Libraries for .NET and Azure

    Further leveraging the relationship that vaulted Microsoft and OpenAI into leadership positions in the AI era, Microsoft this week announced stable versions of two new OpenAI libraries.

  • Microsoft Further Embraces OpenAPI Spec (formerly Swagger)

    Microsoft has long embraced the OpenAPI Specification (formerly known as Swagger) for describing APIs, and it's now taking that support to the next level with a new online resource.

  • Get Good at DevOps: Feature Flag Deployments with ASP.NET WebAPI

    They provide developers with the ability to toggle features on and off without having to redeploy code, making it easier to manage risk, test features in production, and facilitate smoother releases.

  • Implementing k-NN Classification Using C#

    Dr. James McCaffrey of Microsoft Research presents a full demo of k-nearest neighbors classification on mixed numeric and categorical data. Compared to other classification techniques, k-NN is easy to implement, supports numeric and categorical predictor variables, and is highly interpretable.

Subscribe on YouTube