News

Q&A with Rockford Lhotka: Migrating C# Code from .NET Framework to .NET Standard

Microsoft's game-changing .NET Core initiative that's superseding the Windows-only .NET Framework will this year reach an important milestone, .NET 5, a unification of all things .NET. Key to this cross-platform transition is .NET Standard, which specifies APIs common across all .NET implementations, created to allow libraries to build against an agreed-on set of common APIs so they work in mobile, desktop, IoT, web, or any other .NET applications.

With .NET 5 coming in November, we caught up with expert .NET developer, author and frequent speaker Rockford Lhotka to get his take on migrating to the new way. He's the man for the job, as he will be at the upcoming Visual Studio Live! conference in Austin running from March 30 to April 3 for a presentation titled "Migrate Your C# Code from .NET Framework to .NET Standard."

What are some of the top issues that development teams need to consider when moving from .NET Framework to .NET Standard/.NET Core?
The first step is to ensure your existing .NET Framework code and apps are running .NET Framework 4.7.2 or higher -- that's basically the core requirement to a smooth migration going forward.

The second step is to evaluate each of your apps. Are the apps well-architected so there's no business or data access code in the UI? If so life is pretty good, but if not then you need to (a) update as-is and lose out on modern benefits; (b) update to a good architecture, then move forward; (c) rewrite the app from scratch.

What are the top pain points people usually run into when transitioning?
So much depends on how well-architected your current code is relative to separation of data, business, and UI logic. If your code has good separation the pain is that of learning new and exciting things to take advantage of.

"If your code has good separation the pain is that of learning new and exciting things to take advantage of. If your code has poor separation, then getting good separation is the pain point."

Rockford Lhotka, CTO, Magenic

If your code has poor separation, then getting good separation is the pain point.

What's your #1 top tip for making the process go smoother?
Get to .NET Framework 4.7.2, move your non-UI code to a .NET Standard project, then work on your new .NET Core UI.

.NET Core or .NET Standard?
.NET Core is the current runtime for .NET, especially ASP.NET Core, but also the latest Windows Forms and WPF. Contrast this to .NET Standard, which allows you to create common DLLs that contain data access or business logic so those DLLs can be used by .NET Framework and .NET Core (and Xamarin and Blazor) apps.

Is it absolutely necessary to move now? If people don't move, what benefits are they missing out on?
It is not necessary to move now, but it is necessary to have a plan to move. Microsoft has said .NET Framework 4.8 is the last version of the framework. All new features and capabilities are going into .NET Core (really into .NET 5, which is the evolution of .NET Core). The longer you wait to become current, the more technical debt you will accumulate, and the harder it will be to find developers willing to work on legacy technology.

Any "Gotchas" with the process you want to pre-warn readers about?
There are different ways to move your data and business code to .NET Standard. Direct upgrade, multi-targeting projects, and using shared projects. Each has good and bad points, and it is important to understand the tradeoffs before starting the modernization process.

About the Author

Becky Nagel is the vice president of Web & Digital Strategy for 1105's Converge360 Group, where she oversees the front-end Web team and deals with all aspects of digital strategy. She also serves as executive editor of the group's media Web sites, and you'll even find her byline on PureAI.com, the group's newest site for enterprise developers working with AI. She recently gave a talk at a leading technical publishers conference about how changes in Web technology may impact publishers' bottom lines. Follow her on twitter @beckynagel.

comments powered by Disqus

Featured

.NET Insight

Sign up for our newsletter.

Terms and Privacy Policy consent

I agree to this site's Privacy Policy.

Upcoming Events