Windows Forms Designer for .NET Core Released

Olia Gavrysh

Olia

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!

.NET Core Windows Forms designer in Visual Studio

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

Enabling .NET Core Windows Forms designer in Visual Studio Settings

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 and ToolStripContainer (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 control This 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 to true).
    • 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).

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
We are working closely with the control vendors such as Progress Telerik, DevExpress and GrapeCity on supporting their controls in the Windows Forms designer in the nearest future for .NET Core and .NET 5 projects. We are also collaborating with ActiPro, Infragistics, and SyncFusion. On the following picture, you can see Progress Telerik controls in Windows Forms application targeting .NET 5.

Using Progress Telerik RadGridView control in .NET 5

New in 16.6 GA release

The following controls support and improvements have been made in the 16.6 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

The following controls support and improvements have been made in the 16.7 Preview 1 release.
  • UserControl and custom controls infrastructure
  • TableLayoutPanel
  • 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:

  1. Right-click on the Toolbox > Choose Items
  2. 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.

Giving feedback directly from Visual Studio

Getting started:

Porting

70 comments

Comments are closed. Login to edit/delete your existing comments

  • Avatar
    Jonathan Guizar

    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

  • Avatar
    DW

    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.

  • Stuyvenstein
    Stuyvenstein

    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?

    • Davi Bertozo
      Davi Bertozo

      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?

      • Avatar
        Jorge Morales Vidal

        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.

        • Olia Gavrysh
          Olia GavryshMicrosoft employee

          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/

          • Avatar
            Warren R

            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.

    • Avatar
      Jorge Morales Vidal

      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/

  • Avatar
    Nawfal Hassan

    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.

  • Avatar
    Paul Cohen

    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.

    • Avatar
      Kathleen DollardMicrosoft employee

      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.

    • Avatar
      DevDot_Studio

      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

  • Avatar
    thomas woelfer

    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?

    • Olia Gavrysh
      Olia GavryshMicrosoft employee

      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.

      • Avatar
        Hans Christian Falkenberg

        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.

  • Avatar
    hassan hilaly

    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.

    • Olia Gavrysh
      Olia GavryshMicrosoft employee

      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