News

Microsoft Explains How to Port Desktop Apps to .NET Core 3.0

With cross-platform .NET Core 3.0 poised to support desktop applications -- the next step in totally subsuming the Windows-only .NET Framework -- Microsoft has published guidance on how to port existing WinForms and WPF projects to the new platform.

As the .NET Core and .NET Standard initiatives progressed over the past few year, support for Windows Forms and Windows Presentation Foundation applications was introduced in a recent.NET Core 3.0 preview. "The big deal here is now that if you're a WinForms or WPF developer you can actually utilize the .NET Core runtime," Microsoft's Beth Massi announced at VSLive! conference last October, while proclaiming .NET Core is the best target for new development projects.

"So you shouldn't feel pressured to move off .NET Framework, but just know that it's going to be much more highly targeted compatible fixes kind of going forward and we recommend that all new development that you start on .NET is on .NET Core if possible," Massi said.

"As we move forward into the future, with .NET Core 3, we're going to see some more workloads that we're going to be working on here, mainly Windows desktop."

Beth Massi, Product Marketing Manager, .NET Platform, Microsoft

Even prior to that, Microsoft created a portability analyzer tool to help developers check if their WinForms and WPF applications were ready for the new platform.

Now, with v.3.0 coming sometime this year, Microsoft is seeking to help developers move to the new platform, existing apps and all.

"In typical cases, just retargeting your projects to .NET Core isn’t enough," said Olia Gavrysh, .NET program manager, in a blog post this week.

She explained in detail how to port a WinForms desktop application that includes multiple projects from .NET Framework to .NET Core, including how to deal with potential problems that might arise and how to fix them.

On particularly interesting tip in the presentation (also done in a video) explains how developers can keep using the WinForms designer in Visual Studio even though it's under development and not yet available for .NET Core projects. That's done in two different ways:

  • You can keep your files linked (by just not performing a previous step) and copy them when the designer support is available. This way, you can modify the files in your old .NET Framework WinForms project using the designer. And the changes will be automatically reflected in the new .NET Core WinForms project -- since they’re linked.
  • You can have two project files in the same directory as your WinForms project: the old .csproj file from the existing .NET Framework project and the new SDK-style .csproj file of the new .NET Core WinForms project. You’ll just have to unload and reload the project with corresponding project file depending on whether you want to use the designer or not.

Otherwise the post contains detailed guidance on preparing to port, porting the main project and then porting the UI for the application, which is a memory board game targeting .NET Framework 4.5. Though it's a WinForms application, Gavrysh said WPF projects work similarly.

Specifically, she explains how to port the application project to .NET Core 3.0 and the class library to .NET Standard 2.0. "Using .NET Standard instead of .NET Core allows me to reuse the game logic to provide the application for other platforms, such as iOS, Android or Web," she said.

As the tutorial requires installation of .NET Core 3, using a Visual Studio 2019 Preview version is a prerequisite.

About the Author

David Ramel is an editor and writer at Converge 360.

comments powered by Disqus

Featured

  • Mastering Blazor Authentication and Authorization

    At the Visual Studio Live! @ Microsoft HQ developer conference set for August, Rockford Lhotka will explain the ins and outs of authentication across Blazor Server, WebAssembly, and .NET MAUI Hybrid apps, and show how to use identity and claims to customize application behavior through fine-grained authorization.

  • Linear Support Vector Regression from Scratch Using C# with Evolutionary Training

    Dr. James McCaffrey from Microsoft Research presents a complete end-to-end demonstration of the linear support vector regression (linear SVR) technique, where the goal is to predict a single numeric value. A linear SVR model uses an unusual error/loss function and cannot be trained using standard simple techniques, and so evolutionary optimization training is used.

  • Low-Code Report Says AI Will Enhance, Not Replace DIY Dev Tools

    Along with replacing software developers and possibly killing humanity, advanced AI is seen by many as a death knell for the do-it-yourself, low-code/no-code tooling industry, but a new report belies that notion.

  • Vibe Coding with Latest Visual Studio Preview

    Microsoft's latest Visual Studio preview facilitates "vibe coding," where developers mainly use GitHub Copilot AI to do all the programming in accordance with spoken or typed instructions.

  • Steve Sanderson Previews AI App Dev: Small Models, Agents and a Blazor Voice Assistant

    Blazor creator Steve Sanderson presented a keynote at the recent NDC London 2025 conference where he previewed the future of .NET application development with smaller AI models and autonomous agents, along with showcasing a new Blazor voice assistant project demonstrating cutting-edge functionality.

Subscribe on YouTube