Since desktop support for .NET Core 3.0 has been released, ComponentOne continues to offer improved support for .NET Core 3.0 in WinForms and WPF. One of the major differences (between WPF and WinForms .NET Core) is the lack of a design-time experience for WinForms applications. Microsoft has announced that the .NET Core Windows Forms designer is slated to release at the end of 2020. You can check out the preview version of the designer in 16.4 Preview 3 or later here.

Why Windows Desktop on .NET Core?

.NET Core is the future of .NET (as .NET 5 will be built upon it). As Olia from Microsoft states, "The .NET Framework will be supported for years to come, however, it will not be receiving any new features. While WinForms and WPF applications will never be cross-platform, .NET Core itself is designed to be cross-platform."

Other benefits that .NET Core bring to desktop applications:
  • Self-contained deployment with single .exe files
  • Side-by-side deployment using different versions of .NET Core
  • Smaller app sizes & improved performance

Plus, the .NET Core versions of Windows Forms and WPF will become a part of the .NET 5 platform. So, by porting your application to .NET Core today you are preparing them for .NET 5.

Using the ComponentOne WinForms. NET Core 3.0 Project Templates

In the 2019 ComponentOne v3 release, we’ve included new project templates that make working with .NET Core and WinForms much easier. Since there is no design-time support for WinForms .NET Core projects, it is necessary to use a separate, linked .NET Framework project if you want to use the designer. The new C1 project templates combine a .NET Core project with a classic .NET Framework WinForms project for you. Previously, you had to manually associate the two project files yourself, as described in this blog post. Now we have included three WinForms project templates that allow you to get up and running quickly with a .NET Core WinForms solution with full designer support.

To find these new project templates, open Visual Studio 2019 and begin to create a new project. In the project template, search box type “Windows Forms .NET Core” and then select one of the following C1 templates in either C# or VB:

  • Windows Forms .NET Core 3.0 Themed App – with C1ThemeController
  • Windows Forms .NET Core 3.0 Docking App – with C1Docking interface
  • Windows Forms .NET Core 3.0 RibbonAndGrid App – with C1Ribbon and C1FlexGrid

Working with .NET Core 3.0 and ComponentOne WinForms Project Templates

You can also select “C1” from the Project Types dropdown to help filter the list. Note that each project template starts you off with some C1 libraries as well.

For example, choose the RibbonAndGrid App.

After selecting the RibbonAndGrid template Visual Studio will generate two projects:

  1. RibbonAndGrid (.NET Framework 4.5.2)
  2. RibbonAndGridCore (.NET Core 3.0)

You’ll notice that the Forms are duplicated in each project, but upon closer inspection, you should see that the Forms within the .NET Framework project are linked to the file that actually lives within the .NET Core project. That means any changes that you make to the .NET Framework Form (through the designer) will take effect in the .NET Core app.

The image below shows the multi-project template layout.

Working with .NET Core 3.0 and ComponentOne WinForms Project Templates

It’s important to keep in mind that the .NET Framework Project is primarily all for show. While it compiles when you build the entire solution, the .NET Core project does not reference or require it at all. It’s only there so you can open the Forms in the designer.

Also, you’ll need to reference the same ComponentOne libraries in each project. The .NET Framework project typically references the dlls and .NET Core uses NuGet packages.

Working with .NET Core 3.0 and ComponentOne WinForms Project Templates

The NuGet packages for ComponentOne controls are newly added since the 2019 v3 release. They get installed at C:\Program Files (x86)\ComponentOne\Packages if you want to build a local repository, otherwise you can install them through NuGet.org.

.NET Core Follow-up

.NET Core by itself is not that ground-breaking for Windows Forms developers, however, it’s quite interesting as a bridge to the next major version of .NET 5. By that time, Microsoft should have the designer situation resolved so this article will be completely null and void before 2021.

Have questions or feedback? Please provide your feedback on our .NET Core support forum thread.

Try ComponentOne Studio

Download the latest version of ComponentOne Studio Enterprise

Download Now!