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 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.