9 Easy Steps to Port a WPF Application to .NET Core | Syncfusion Blogs
Live Chat Icon For mobile
Live Chat Icon
Popular Categories.NET  (179).NET Core  (29).NET MAUI  (214)Angular  (110)ASP.NET  (51)ASP.NET Core  (82)ASP.NET MVC  (89)Azure  (41)Black Friday Deal  (1)Blazor  (225)BoldSign  (15)DocIO  (24)Essential JS 2  (109)Essential Studio  (200)File Formats  (68)Flutter  (133)JavaScript  (226)Microsoft  (120)PDF  (81)Python  (1)React  (105)Streamlit  (1)Succinctly series  (131)Syncfusion  (938)TypeScript  (33)Uno Platform  (3)UWP  (4)Vue  (45)Webinar  (52)Windows Forms  (61)WinUI  (71)WPF  (162)Xamarin  (161)XlsIO  (38)Other CategoriesBarcode  (5)BI  (29)Bold BI  (8)Bold Reports  (2)Build conference  (9)Business intelligence  (55)Button  (4)C#  (157)Chart  (139)Chart of the week  (53)Cloud  (15)Company  (443)Dashboard  (8)Data Science  (3)Data Validation  (8)DataGrid  (68)Development  (654)Doc  (8)DockingManager  (1)eBook  (99)Enterprise  (22)Entity Framework  (7)Essential Tools  (14)Excel  (43)Extensions  (22)File Manager  (7)Gantt  (19)Gauge  (12)Git  (5)Grid  (31)HTML  (13)Installer  (2)Knockout  (2)Language  (1)LINQPad  (1)Linux  (2)M-Commerce  (1)Metro Studio  (11)Mobile  (512)Mobile MVC  (9)OLAP server  (1)Open source  (1)Orubase  (12)Partners  (21)PDF viewer  (43)Performance  (12)PHP  (2)PivotGrid  (4)Predictive Analytics  (6)Report Server  (3)Reporting  (10)Reporting / Back Office  (11)Rich Text Editor  (12)Road Map  (12)Scheduler  (54)Security  (4)SfDataGrid  (9)Silverlight  (21)Sneak Peek  (31)Solution Services  (4)Spreadsheet  (11)SQL  (14)Stock Chart  (1)Surface  (4)Tablets  (5)Theme  (12)Tips and Tricks  (112)UI  (393)Uncategorized  (68)Unix  (2)User interface  (68)Visual State Manager  (2)Visual Studio  (31)Visual Studio Code  (19)Web  (611)What's new  (333)Windows 8  (19)Windows App  (2)Windows Phone  (15)Windows Phone 7  (9)WinRT  (26)
WPF - .NET Core Image

9 Easy Steps to Port a WPF Application to .NET Core

As the world moves toward cross-platform application development, most developers are choosing these methods to build their applications and are migrating their existing applications to platforms that make this easier. In this blog, I am going to walk you through porting an existing WPF application to .NET Core in 9 easy steps.

For my example, I am choosing ExpenseAnalysis, a Syncfusion WPF showcase application, to port to a .NET Core application.

Step 1: Set up the environment.

To develop a .NET Core WPF application, you need Visual Studio 2019 and .NET Core 3.0 installed in your machine.

Step 2: Check that all the APIs are .NET Core compatible.

Before starting to port an application, check whether all the APIs are compatible using .NET Portability Analyzer.

Step 3: Create the project file.

Now add a new .csproj file. In this example, ExpenseAnalysisDemo_NetCore.csproj is added to the same folder where the other .NET .csproj files are placed. Add the following content in to the new .csproj file.

<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">

Step 4: Declare assembly name and default namespace.

Specify the assembly name and default namespace in the new project file as it is in the .NET project.


Step 5: Suppress auto generation of AssemblyInfo.

A .NET Core project will automatically generate an AssemblyInfo.cs file. As we already have it, we need to suppress the auto generation by setting GenerateAssemblyInfo to false.


You don’t have to add any .cs or .xaml. They will automatically be added.

Step 6: Add necessary NuGet packages in the project file.

Unlike in .NET projects, the packages.config file will not be considered in .NET Core. Instead, you have to add the necessary NuGet package reference in the .NET Core project file.

	<PackageReference Include="Syncfusion.Compression.Base" version="" />
	<PackageReference Include="Syncfusion.Data.WPF" version="" />
	<PackageReference Include="Syncfusion.DataGridExcelExport.Wpf" version=""/>
	<PackageReference Include="Syncfusion.Licensing" version="" />
	<PackageReference Include="Syncfusion.Pdf.Wpf" version="" />
	<PackageReference Include="Syncfusion.SfChart.WPF" version="" />
	<PackageReference Include="Syncfusion.SfGrid.WPF" version="" />
	<PackageReference Include="Syncfusion.Shared.WPF" version="" />
	<PackageReference Include="Syncfusion.XlsIO.Wpf" version="" />
	<PackageReference Include="Syncfusion.XlsIO.Wpf" version="" />

Step 7: Add necessary resources to the project file.

The project may use different resources and images for various purposes. Add these resources to the .NET Core project manually in the ItemGroup section.

<Resource Include="**\*.png" />
<Resource Include="App.ico" />

Step 8: Open and run.

Open the project file in Visual Studio 2019 and run the Expense Analysis showcase.Expense Analysis .NET Core project output

You can now interact with this report and use grids, charts with filtering, pagination, exporting, etc.

Step 9: Use condition compilation for framework-specific code.

After exporting data in the DataGrid, Expense Analysis will suggest opening the file. On choosing yes, the file will not open, as Process.Start() will lead to a Win32Exception: “The specified executable is not a valid application for this OS platform.”View Confirmation

Opening a file through .NET Core is different from .NET Framework, so use condition compilation to resolve this issue.

    ProcessStartInfo psi = new ProcessStartInfo
        FileName = "cmd",
        WindowStyle = ProcessWindowStyle.Hidden,
        UseShellExecute = false,
        CreateNoWindow = true,
        Arguments = "/c start " + sfd.FileName


With this, we have successfully migrated a WPF .NET Framework project to .NET Core. The migrated application of this converted project is provided for your reference in this GitHub location.

All Syncfusion WPF and WinForms components support .NET Core 3.0. From the recent 17.2 release, you can run existing WPF and WinForms product showcase demos in both .NET Core and .NET Framework.WPF Dashboard

Download the Syncfusion WinForms and WPF samples from their respective locations and use these controls for your development needs in .NET Core. Share your feedback in the comment section.

You can always contact us using Direct Trac, our support forum, or the feedback portal. We are happy to assist you.


Share this post:

Comments (2)

[…] on August 20, 2019by admin submitted by /u/prabakarinfo [link] [comments] No comments […]

I just came to your blog yesterday and I have been checking it out often. You have a ton of good information on the site and I love the design of the website also. Keep up the great work!

Comments are closed.

Popular Now

Be the first to get updates

Subscribe RSS feed

Be the first to get updates

Subscribe RSS feed