System.drawing namespace not found under console application(在控制台应用程序下找不到 System.drawing 命名空间)
问题描述
我选择控制台应用程序作为我的 C# 项目.但是似乎在 Windows 窗体项目下工作的导入在这里似乎不起作用.它说绘图命名空间不存在.
I selected console application as my C# project. But the imports that seemed to work under Windows Form project don't seem to work here. It says that the drawing namespace does not exist.
using System.Drawing;
using System.Drawing.Imaging;
我的问题是我需要有位图类.我正在尝试制作一个对图像进行位图操作的命令行应用程序.这就是为什么我没有将我的项目选择为 Windows Form one.
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 choose my project to be a Windows Form one.
推荐答案
- 右键单击控制台应用程序的属性.
- 检查
目标框架
- 如果是
.Net Framework 4.0 Client Profile
,则将其更改为.Net Framework 4.0
- Right click on properties of Console Application.
- Check
Target framework
- If it is
.Net framework 4.0 Client Profile
then change it to.Net Framework 4.0
现在可以使用了
这篇关于在控制台应用程序下找不到 System.drawing 命名空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!