How to specify a component icon for .Net 6 WinFroms desinger

Aerworker 0 Reputation points
2023-01-11T10:26:00.0333333+00:00

To specify an icon for a component class for .Net 5 and earlier versions it was enough to add a ToolboxBitmapAttribute. But starting form .Net 7 it throws an exception on Linux. So it is impossible to call TypeDescriptor.GetAttributes(type) method without an exception. Now on standard types there is no ToolboxBitmapAttribute (for example BackgroundWorker class). Therefore, there must be another way to set the icon. How to do this now?

Windows Forms
Windows Forms
A set of .NET Framework managed libraries for developing graphical user interfaces.
1,921 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.