Windows Forms Designer for .NET Core Released
Today we’re happy to announce that the Windows Forms designer for .NET Core projects is now available as a preview in Visual Studio 2019 version 16.6! We also have a newer version of the designer available in Visual Studio 16.7 Preview 1!
Don’t forget to enable the designer in Tools > Options > Environment > Preview Features.
Many of you may remember that we open-sourced Windows Forms and ported it to .NET Core with .NET Core 3.0. Since then, we’ve been hard at work bringing the Windows Forms designer experience to .NET Core. While we are getting closer to completion, we are continuing work on the designer and plan on bringing more functional and performance improvements in the near future.
How to use the designer
- Install Visual Studio 2019 version 16.6 or Visual Studio 2019 version 16.7 Preview 1.
- To enable the designer in Visual Studio, go to Tools > Options > Environment > Preview Features and select the Use the preview Windows Forms designer for .NET Core apps option.
After completing these steps, once you double-click on your form in the Solution Explorer, the designer will open automatically the same way it is for .NET Framework applications.
Improving the performance is our next goal after we complete the functionality work, so don’t get upset if it’s not as fast as you envisioned while the designer is in the preview, that’s something we will improve in the future.
Currently the new Windows Forms designer works only on Windows 10.
What’s available in the designer
- All Windows Forms controls except
DataGridView
andToolStripContainer
(these are coming soon) UserControl
and custom controls infrastructure (only available since Visual Studio 16.7 Preview 1 version)- All designer functionality, such as
- drag-and-drop
- selection, move and resize
- cut/copy/paste/delete
- integration with Properties Window
- events generation and so on
- New
WebView2
controlThis chromium-based embedded browser control allows to render web content (HTML/CSS/JavaScript) for .NET apps. It is supported in both .NET Core and .NET Framework platforms for Windows Forms and WPF applications. You can find a getting started tutorial in the Microsoft documentation and we will publish a blog post dedicated to WebView2 control in the nearest future. - Local resources
- Partial support for localization
- Localizable properties of the controls and UserControl can be serialized into ResX-files (by setting
Localizable
property totrue
). - Different languages are supported via changing
Language
property. - Additional
Cultures
are added in the preview of .NET 5 according to the International Components for Unicode Standard (ICU).
- Localizable properties of the controls and UserControl can be serialized into ResX-files (by setting
What’s coming next
- Project resources
- Complete localization
- Inherited dialogs support
- Data binding scenarios
This work is in progress, and you already can see some results in the Visual Studio 16.7 Preview 1 designer.
- Third-party control vendors support
New in 16.6 GA release
- All Dialogs controls
PropertyGrid
HScrollBar
VScrollBar
DomainUpDown
TrackBar
- Drag-and-drop improvements
- Selection improvements
- Stability and bug fixes
New in 16.7 Preview 1 release
UserControl
and custom controls infrastructureTableLayoutPanel
- Fundamentals for third-party controls support
- Fundamentals for data binding support
- Improvements in designer interaction with the
TableLayoutPanel
Known issue
Some users might not see some controls (like Button, CheckBox, etc.) in the Toolbox. That happens due to the Toolbox cache corruption issue that will be fixed in the next version. Meanwhile, there is a simple way to fix it on your machine:
- Right-click on the Toolbox > Choose Items…
- In the Choose Toolbox Items dialog click “Reset” button
This should fix the problem.
Give us your feedback!
Your feedback is important to us! Please report issues and send feature requests via the Visual Studio Feedback channel. Use the “Send Feedback” icon in Visual Studio top-right corner as shown in the following image and specify that it is related to the “WinForms .NET Core” area.
Related links
Getting started:
- Creating your first Windows Forms app on .NET Core
- Creating your first WPF app on .NET Core
- Differences between .NET Framework and .NET Core for desktop apps
Porting
- Simple porting case
- Advanced porting case (Part 1, Part 2)
- Overview of the porting process
70 comments
Nice! thank you very much for your hard work! 😁
Let’s hope we can start porting our third party controls dependant WinForms applications to .NET 5 later this year
Thank you! Which control vendor are you using?
Wait, I was under the impression that Win Forms was in maintenance mode. When did that change? What is the future roadmap?
Last year we open sourced WinForms and brought it to .NET Core. Now it is available in .NET 5 preview and reviewing new features (like Task Dialog) and lots of PRs from the ole source community. You can check out the repo and the roadmap here: https://github.com/dotnet/winforms/blob/master/roadmap.md
Thank you for your hard work!!
If you can provide a few examples of creating and running WinForm/WPF programs, or if a link exists, please leave me a comment.I will study hard.We are currently using a third-party Devexpress vendor and are considering cross-platform support.
Thanks again.
Getting started with WinForms and WPF on Core:
https://www.youtube.com/watch?v=a66wsCRSgDk
https://www.youtube.com/watch?v=Y4pthq_zGvI&t=6s
Differences between .NET Framework and .NET Core for desktop apps
https://www.youtube.com/watch?v=Y4pthq_zGvI&t=6s
Porting from .NET Framework
https://devblogs.microsoft.com/dotnet/net-core-3-for-windows-desktop/
Advanced porting cases for WPF apps
https://devblogs.microsoft.com/dotnet/migrating-a-sample-wpf-app-to-net-core-3-part-1/
https://devblogs.microsoft.com/dotnet/migrating-a-sample-wpf-app-to-net-core-3-part-2/
Hi. I don’t see anything about cross-platform use. Since it says Windows Forms, is it safe to assume that this is Windows only feature? And that it will not be available on Linux?
Thats the point! Waiting for MS’s Reply too. Dont make any sense for me if its not a cross platform option when it’s compete against all web technologies. Why use a tecnology thats anchor in an specific OS?
Hi, you can read more about the rationale about porting Windows Forms from .NET Framework to .NET Core in this link:
https://devblogs.microsoft.com/dotnet/net-core-3-for-windows-desktop/
Basically the reason is to bring the benefits that .NET Core has to the broader Windows Forms community which has a lot of developers, specially in developing countries. Besides that, Microsoft already open sourced Windows Forms and WPF (Windows Presentation Foundation) libraries.
They will remain Windows-centric as they depend on Windows APIs, but they will benefit of all new NuGet libraries and features that are based on .NET Core.
Thanks Jorge! You’re absolutely right, Windows Forms will be Windows only. Of course if we were to create a new desktop platform from scratch right now, we’d design it as a cross-platform. But Windows Forms was designer long time ago, and built completely on Windows API, so making it cross-platform would be close to rewriting it completely.
Windows Forms still has lots of users and with supporting it in .NET Core and .NET 5 we are making sure those users can benefit from from all the performance improvements and new features. This platform is fully supported and will receive all the updates in the future.
If you need a cross-platform solution, we just announced .NET MAUI – .NET Multi-platform App UI: https://devblogs.microsoft.com/dotnet/introducing-net-multi-platform-app-ui/
Sorry, what exactly “benefits” Core has, which is unavailable (and VERY needed!) in .NET FW world?!
Windows Forms + .NET Core allows you to ship your UI framework with your application, independently of the version of the framework installed with Windows. This puts it in line with Qt, Swing, and most other GUI frameworks.
The independence helps avoid problems like this one, whereby upgrading a system from .NET 4.0 to 4.5 introduced problems with almost any app that uses a menu MenuStrip, due to bugs in 4.5. Some hard lessons were learned by the team in that 4.5-4.6 time period and Microsoft had to start building .NET Framework in such a way that any new behaviours (including bug fixes!) would need to be opted into on a per-application basis. But that has proven to have its limits, too, because third-party libraries have to understand all the potential variances in behaviour, too.
.NET Core also has significantly better overall performance than .NET Framework. A lot of those perf improvements cannot be backported to Framework because it might break something and it isn’t worth the risk.
Hi, you can read more about the rationale about porting Windows Forms from .NET Framework to .NET Core in this link:
https://devblogs.microsoft.com/dotnet/net-core-3-for-windows-desktop/
Basically the reason is to bring the benefits that .NET Core has to the broader Windows Forms community which has a lot of developers, specially in developing countries. Besides that, Microsoft already open sourced Windows Forms and WPF (Windows Presentation Foundation) libraries.
They will remain Windows-centric as they depend on Windows APIs, but they will benefit of all new NuGet libraries and features that are based on .NET Core.
If you want to know more about cross platform UI development, you can read yesterday’s announce in Build 2020 about .NET MAUI (Multi-platform App UI) which covers developing apps with C# in .NET 5 for macOS, Windows, iOS and Android:
https://devblogs.microsoft.com/dotnet/introducing-net-multi-platform-app-ui/
Hi,
Will These features would be available on visual studio for Mac
Windows Forms will remain Windows-only platform, so those features won’t be in Visual Studio for Mac
Hello, awesome update thank you. I wish we can deploy WinForms app in Linux and MacOS.
I totally understand that desire. Unfortunately, we cannot do it because WinForms has too many dependencies on Windows APIs. There are other solutions like XAMARIN and .NET MAUI that might help.
Great work, thanks a lot.
May I ask, if ever WinForms designer will support forms with generic base class?
We have a bunch of forms that inherit from a common base class like FormBase{TViewModel}. For us the FormBase{TViewModel} does a lot of heavy-lifting and it is essential to our existing infrastructure. But the WinForms designer crashes for inherited types. Eg. cant open the designer of Foo where `Foo : FormBase{FooViewModel}`. There are certain hackish workarounds available on the internet but they all work only maybe at best 50% of the times.
Yes, visual inheritance in designer definitely must be improved! Especially important that, is when you in x64 configuration current VS designer can’t handle it 🙁
Yes! We will definitely support it, this is our next item on the roadmap after completing third-party controls and data binding scenarios! Sorry for your struggle now, we are working hard on getting it all done!
I have added tickets for these: https://github.com/dotnet/winforms/issues/3328 https://github.com/dotnet/winforms/issues/3329
With the preview released today Visual Basic designer support is completely broken for core projects (null reference Dialog if you try to open any form in designer). They do work in release version at least for supported controls.
Could you report that bug in the designer. If you could also include the code of a simple form that illustrates the problem it will help us get it fixed quickly.
Reporting via Visual Studio feedback tool (upper right corner) is probably best.
I have the same problem . I updated visual studio to lastest version (16.6) ,created new winforms .Net core project but when I clicked the form to open the designer an null reference message box appeared .I’m not sure why but I had not this problem in .Net Framework.
Thank you so much .Net team and Microsoft for your hard work you are the best
hi Olia.
i just installed 16.6 and created a new forms app (core). In the toolbox, there are quite a lot of controls. but the button is missing. Whats up with this? Known problem?
Button is there. Looks like issues with your machine. Try to clean VS toolbox cache: delete (save a copy somewhere just in case 🙂 ) file C:\Users{your user}\AppData\Local\Microsoft\VisualStudio\16.0_{***}\privateregistry.bin that has the latest edit date.
Hi, also in my machine button control is missing, Visual Studio 16.7 Preview 1
But cleaning VS toolbox cache resolve this.
Simply deleting privateregistry.bin did not work for me, but also deleting the toolbox files did. Only deleting the toolbox files led to them not being recreated.
Note that you will also reset UI customizations (theme, position of windows, code styles, etc), which is a pain. But seeing as how that Button control is kind of important, I guess it just has to be borne.
These are the files I deleted (in the directory mentioned by Olia):
privateregistry.bin
privateregistry.bin.LOG1
privateregistry.bin.LOG2
toolbox.tbd
toolboxIndex.tbd
toolboxIndex_reset.tbd
toolbox_reset.tbd
ToolboxItemDiscoveryCache.7036b125-fa82-3aba-acb8-bdbc97782a06.dat
Also, don’t have a tab with the designer open. Visual Studio froze when I tried to start it with opening such a solution and I had to delete the .vs directory.
We’ve created an issue for that and investigating, I’ll get back once it’s resolved, thanks you for reporting.
For now another way to try to fix it:
1. right-click on the Toolbox > Choose Items…
2. In the Choose Toolbox Items dialog “Reset”
That worked.
WM_THX
-thomas woelfer
Hi; When i double-click on the form in the Solution Explorer i have this warnig message : The object reference is not defined to an instance of an object.
please what to do to resove this probleme.
That’s weird. Could you please report the problem via Visual Studio feedback (described in the end of this blog post). Would be great to have a sample app you’are trying to open, and to know if that is for any app or for some specific app
Things that I’d try to resolve it:
* Close and reopen VS. Give it time to load everything before opening the form
* Go to Tools > Options > Environment > Preview Features and make sure the “Use the preview Windows Forms designer for .NET Core apps” is selected. Maybe uncheck and check it again 🙂
* Check what your application is targeting, and ensure you have the required SDK installed on your machine (for example if the app you’re trying to work with
targets net5 your need .NET 5 SDK)
* Reinstall VS
I hope you’ll be able to fix it
We are facing the same issue…
I would really like to avoid reinstalling VS.