C# notifyIcon: The type 'Icon' is defined in an assembly that is not referenced

172 views Asked by At

When adding a notifyIcon from Toolbox in Visual Studio and assigning an icon to it, I get the following error with the line "this.notifyIcon1.Icon = ((System.Drawing.Icon)(resources.GetObject("notifyIcon1.Icon")));" when compiling:

CS0012 "The type 'Icon' is defined in an assembly that is not referenced."

CS0234 "The type or namespace name 'Icon' does not exist in the namespace 'System.Drawing'."

How to solve this error?

Here's the code of the *.Designer.cs file, where the error occures:

    private void InitializeComponent(){

        ...

        this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components);
        // 
        // notifyIcon1
        // 
        this.notifyIcon1.Icon = ((System.Drawing.Icon)(resources.GetObject("notifyIcon1.Icon")));
        this.notifyIcon1.Text = "notifyIcon1";
        this.notifyIcon1.Visible = true;

        ...

    }
0

There are 0 answers