I have recently heard that the alpha version of .NET Core (.NET Core 3.0) supports Windows Forms and WPF. But the Visual Studio Designer (and Visual Studio) doesn\'t
WinForms project you can refer to this videoHow to fix WinForms Designer not support .net core 3.0 visual studio 2019
Since this video give more details we need, we can be followed step by step. It is also based on Microsoft official github project dotnet/winforms
dotnet/winforms - Using the Classic WinForms Designer in WinForms Core
The related code (VS project) made by me is already pushed to github:
.netCore-WinForms_Designer
WPF project you can use XAML Designer as below:Reference:
dotnet/samples - WPF Hello World sample with linked files
Firstly, you need to Install vs 2019 Professional/Enterprise version. Then installing .net core 3.0 SDK is needed. Now you can try to create a .net core WPF application,
After setting the relevant project name and storage path, it will pop up:
After setting done, restart vs to take effect.
Now the file structure of the solution is below:
Right click the project CoreHiWPF, select Properties, then change its Assembly Name to HiWPF.
Then right click the project, click "Edit CoreHiWPF.csproj".
Add code as below:
MSBuild:Compile
MSBuild:Compile
If the .net core WPF project CoreHiWPF is already highlighted, you can ignore then. Or, you need to select project CoreHiWPF, then right click Set As Start up project.
Now close all opened files. Click the file MainWindow.xaml of project HiWPF. Then you can see empty WPF window in XAML designer now.
Then, I add two lines to Grid of the file MainWindow.xaml:
- One line is a Label which support Wrap
- The other line is a Exit button.
Then I added the Click event to Exit button, added the Loaded event to Window.
After finish updating code, press F5 to run, the final UI is below:
The code is also already pushed to github:
.netCore-WPF_Designer .
You can clone it directly to have a look.