System.Windows.Forms를 사용할 수 없습니다.
나는 (내 첫 번째) C # 프로그램을 만들어 보았습니다.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("hello");
Console.ReadLine();
}
}
}
이것은 잘 진행되지만 System.Windows.Forms를 사용하려고하면 :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("hello");
System.MessageBox("hello");
Console.ReadLine();
}
}
}
이것은 내가 얻는 오류입니다.
Error 1 The type or namespace name 'Windows' does not exist in the namespace 'System' (are you missing an assembly reference?) C:\Users\Ramy\Documents\Visual Studio 2010\Projects\ConsoleApplication1\ConsoleApplication1\Program.cs 5 14 ConsoleApplication1
세부 정보 :-Visual Studio 2012를 사용하고 있습니다. -.NET 개발 키트를 설치했습니다. -콘솔 애플리케이션입니다.
콘솔 응용 프로그램에서 System.Windows.Forms를 사용할 수 없기 때문일까요? 그렇다면 어떤 프로그램이되어야합니까? 나는 또한 양식으로 시도했지만 창만 표시하고 코드는 표시하지 않았습니다.
콘솔 응용 프로그램은 System.Windows.Forms.dll에 대한 참조를 자동으로 추가하지 않습니다.
솔루션 탐색기에서 프로젝트를 마우스 오른쪽 단추로 클릭하고 참조 추가 ...를 선택한 다음 System.Windows.Forms를 찾아 추가합니다.
네임 스페이스 System.Windows.Forms의 참조를 프로젝트에 추가해야합니다. 어떤 이유로 든 이미 추가되지 않았기 때문에 Visual Studio 메뉴에서 새 참조를 추가 할 수 있습니다.
"참조"▶ "새 참조 추가"▶ "System.Windows.Forms"를 마우스 오른쪽 버튼으로 클릭합니다.
"System.Windows.Forms"에 대한 참조를 추가하려면 Visual Studio Community 2017과 약간 다른 것 같습니다.
1) 솔루션 탐색기로 이동하여 참조 선택
2) 마우스 오른쪽 버튼을 클릭하고 참조 추가를 선택합니다.
3) 어셈블리에서 System.Windows.Forms를 확인하고 확인을 누릅니다.
4) 그게 다입니다.
System.Windows.Forms.dll에 대한 참조를 추가하기 만하면됩니다.
솔루션 탐색기가 MS Studio 2008에서 보이는지 확인하십시오. 솔루션 탐색기를보고 클릭하십시오.
In Solution explorer go to Reference Right click on Reference and select Add Reference.. Select .NET tab Scroll down till you find System.Drawing -> select it -> click on OK button Do the same for System.Windows.Forms
When you run your form this will work
(eddie lives somewhere in time)
go to the side project panel, right click on references -> add reference and find System.Windows.Forms
Any time some error like this occurs (some namespace you added is missing that is obviously there) the solution is probably this - adding a reference.
This is needed because your default project does not include everything because you probably wont need it so it saves space. A good practice is to exclude things you're not using.
may be necesssary, unreference system.windows.forms and reference again.
참고 URL : https://stackoverflow.com/questions/9646684/cant-use-system-windows-forms
'Development Tip' 카테고리의 다른 글
프로그래밍 방식으로 CenterX / CenterY 제약 추가 (0) | 2020.11.06 |
---|---|
ASP.NET MVC 3-다른 작업으로 리디렉션 (0) | 2020.11.06 |
CREATE FILE에서 운영 체제 오류 5가 발생했습니다 (이 오류에 대한 텍스트를 검색하지 못했습니다. 이유 : 15105). (0) | 2020.11.06 |
mongodb에서 콘솔을 지우는 방법 (0) | 2020.11.06 |
Kendo 그리드 날짜 열이 형식화되지 않음 (0) | 2020.11.06 |