winforms icon indicating copy to clipboard operation
winforms copied to clipboard

Cannot add custom WinForms control built with .NET 8 to Visual Studio Toolbox (“platform whose toolbox items cannot be enumerated dynamically”)

Open unmeshdev-emerson opened this issue 2 months ago • 5 comments

.NET version

8.0

Did it work in .NET Framework?

Yes

Issue description

When building a simple WinForms control library targeting .NET 8-windows, attempting to add the generated DLL to Visual Studio’s Toolbox using Choose Toolbox Items → Browse… fails with an error.

Is Visual Studio expected to support adding WinForms controls built for .NET 8-windows directly via Choose Toolbox Items → Browse…? Is there any official documentation or roadmap reference that describes Toolbox support (or lack thereof) for modern .NET controls?

Image

Steps to reproduce

  1. Create a new Class Library targeting .NET 8-windows with <UseWindowsForms>true</UseWindowsForms>.
  2. Add a public control:
using System.Windows.Forms;
using System.ComponentModel;

namespace Net8ToolboxControl
{
    [ToolboxItem(true)]
    public class FancyButton : Button
    {
        public FancyButton()
        {
            this.Text = "Fancy .NET 8 Button";
            this.BackColor = Color.LightGreen;
        }
    }
}

  1. Build the DLL.

  2. In Visual Studio 2022 ( in my case version is 17.12.3), open Tools → Choose Toolbox Items → Browse… and select the built DLL.

A minimal reproducible project Net8ToolboxControl.zip is attached which uses step mentioned above:

Net8ToolboxControl.zip

unmeshdev-emerson avatar Oct 31 '25 08:10 unmeshdev-emerson

There has a known issue to track 200,

@unmeshdev-emerson, you can directly import the built class library dll under Dependencies node for winform project, and then the custom control will be loaded in the ToolBox window.

Note: Need to update your Visual Studio to 2026 for this new function

Zheng-Li01 avatar Oct 31 '25 08:10 Zheng-Li01

@Zheng-Li01 , the tracking link you shared seems to return a 404 error — would you mind sharing the correct one?

It might already be covered there there in the link, would like look there for— will this update also allow adding the DLL through Toolbox → Choose Items → Browse, or only through importing the DLL under the Dependencies node?

unmeshdev-emerson avatar Oct 31 '25 09:10 unmeshdev-emerson

@Zheng-Li01 , the tracking link you shared seems to return a 404 error — would you mind sharing the correct one?

The is an internal repo which cannot be visited for outside.

It might already be covered there there in the link, would like look there for— will this update also allow adding the DLL through Toolbox → Choose Items → Browse, or only through importing the DLL under the Dependencies node?

For now, only support importing the DLL under the Dependencies node, and not support adding the DLL through Toolbox → Choose Items → Browse, this issue is under investigating, let you know if there have any update for this.

Zheng-Li01 avatar Oct 31 '25 09:10 Zheng-Li01

Thanks @Zheng-Li01 for clarifying that.

Do we have any tentative plan or timeline for when Toolbox → Choose Items → Browse support might be added? It would really help to know if this feature is planned for a specific Visual Studio or .NET release.

unmeshdev-emerson avatar Oct 31 '25 10:10 unmeshdev-emerson

@Shyam-Gupta is doing work to allow for direct references to assemblies, but I think we're still avoiding the browsing of the dialog and asking for developers just to add the reference to the dll manually. It essentially does the same thing as the Choose Items dialog of populating the ToolBox. You should have this feature for all projects by 18.0 GA. Right now it's only available for .NET Framework projects leveraging the out of process designer. Here's more info. A new blog will come out when the feature is rolled out for all .NET projects next month.

merriemcgaw avatar Oct 31 '25 16:10 merriemcgaw