ContextMenu not recognized by IDE

Christ Kennedy 196 Reputation points
2021-05-31T22:19:44.117+00:00

I'm using a class that I've been working on for months and it suddenly (in a new project) has a major problem and cannot find

System.Windows.Forms.ContextMenu

here's a pic of my screen
101088-contextmenu.png

I am working with .Net 5.0 which, for me, is new.... so that might be the problem. dunno

any idea what assembly reference I'm missing? what I should look for?

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,128 questions
0 comments No comments
{count} votes

Accepted answer
  1. Daniel Zhang-MSFT 9,631 Reputation points
    2021-06-01T01:43:43.777+00:00

    Hi ChristKingKennedy-5906,
    The ContextMenu class is not available in .NET Core 3.1 and later versions. You can use ContextMenuStrip instead, which replaces and extends the ContextMenu control.

    System.Windows.Forms.ContextMenuStrip cm = new System.Windows.Forms.ContextMenuStrip();  
    

    More details please refer to this document.
    Best Regards,
    Daniel Zhang


    If the response is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


1 additional answer

Sort by: Most helpful
  1. Sam of Simple Samples 5,546 Reputation points
    2021-06-01T01:33:34.75+00:00
    0 comments No comments

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.