System.Windows.Forms namespace not recognized in Windows Service

18,586

Solution 1

Add a reference to System.Windows.Forms in the project.

Here is how you do it: (copied from the user below - thankyou!):

you need to add reference to it's assembly

right click your project node in solutions explorer and

choose AddReference --> .Net -->System.Windows.Forms

Just make sure that you don't call MessageBox from your service. It is not a smart thing to do. (Yes, I have blocked services that way)

Solution 2

you need to add reference to it's assembly

right click your project node in solutions explorer and

choose AddReference --> .Net -->System.Windows.Forms

Share:
18,586
Sam Youtsey
Author by

Sam Youtsey

Updated on June 26, 2022

Comments

  • Sam Youtsey
    Sam Youtsey over 1 year

    I've got a service that's acting up. It won't recognize the following namespace declaration:

    using System.Windows.Forms;
    

    What I most need from the Windows.Forms namespace is a WebBrowser control. Any ideas on how to get this working? Thank you.