In my job, I still do a fair amount of work desktop related work which means when I heard that .NET Core 3 is going to bring support for Winforms and WPF I got pretty excited. This post is going to show you how to installing the preview of .NET Core 3 and then using the .NET CLI to a new Winforms or WPF application.
This information was covered in the .NET Core 3 Preview 1 announcement from December, but I thought I might as well document it here as I was trying it out.
Download and Install
Head over to the .NET Core 3 download page and select the SDK for your OS. Keep in mind that Winforms and WPF will only run on Windows machines unlike the rest of .NET which is cross-platform. After the download is complete run the installer and follow the prompts.
Project Creation
Using the .NET CLI you can use the following command to create a Winform application.
dotnet new winforms
Of the following to create a WPF application.
dotnet new wpf
After the project is created for either type you can use the following command to run the application.
dotnet run
The following is an example of what you would see for a new WPF application.
Limitations
If you are going to be playing with the desktop-based framework I recommend that you grab the preview of Visual Studio 2019. Even with the preview, there are no designers available Winforms or WPF as of the time of this writing.
Wrapping Up
I know Microsoft has shown some neat demos, but in this first preview doesn’t have much tooling around it so if you are going to do much more than the new applications as I did above you are going to be in for a lot of manual work. Please don’t take this as a dig, as I said above I am very excited about this functionality.
If you are wondering about what versions of Windows .NET Core 3 will be supported on that information can be found here.