I selected console application as my C# project. But the imports that seemed to work under windows form project doesnt seem to work here. It says that the drawing namespace does not exist.
using System.Drawing;
using System.Drawing.Imaging;
My problem is that i need to have the bitmap class. I am trying to make a command line app that does bitmap manipulations to a image. That's why i didn't chose my project to be a windows form's one.
- Right click on properties of Console Application.
- Check
Target framework - If it is
.Net framework 4.0 Client Profilethen change it to.Net Framework 4.0
It works now
If you are using Visual Studio 2010 or plus then check the target framework that is it .Net Framework 4.0 or .Net Framework 4.0 Client Profile. then change is to .Net Framework 4.0.
You need to add reference this .dll file (System.Drawing.dll) to perform drawing operations.
If it is OK then follow these steps to add reference to System.Drawing.dll
- In
Solution Explorer, right-click on theproject nodeand clickAdd Reference. - In the Add Reference dialog box, select the tab indicating the type of component you want to reference.
-
Select the
System.Drawing.dllto reference, then click OK.
- Add using System.Drawing;
- Go to solution explorer and right click on references and select add reference
- Click on assemblies on the left
- search for system.drawing
- check system.drawing
- Click OK
- Done
For,Adding System.Drawing Follow some steps: Firstly, right click on the solution and click on add Reference. Secondly, Select the .NET Folder. And then double click on the Using.System.Drawing;
Add reference .dll file to project. Right, Click on Project reference folder --> click on Add Reference -->.Net tab you will find System.Drawing --> click on ok this will add a reference to System.Drawing
来源:https://stackoverflow.com/questions/8553136/system-drawing-namespace-not-found-under-console-application

