왜 Console.Writeline, Console.Write가 Visual Studio Express에서 작동하지 않습니까?
콘솔 응용 프로그램을 열고 입력합니다
Console.WriteLine("Test");
그러나 출력 창에는이 표시되지 않습니다. Ctrl + W, O를 사용하여 출력 창으로갑니다.
그러나 프로그램을 실행할 때 아무 것도 나타나지 않습니다. Visual Studio 2010 Express에서 지원되지 않습니까?
Console.WriteLine
응용 프로그램에서 열린 콘솔 창에 출력을 씁니다 (명령 프롬프트를 열 때 나타나는 흰색 텍스트가있는 검은 창을 생각하십시오) System.Diagnostics.Debug.WriteLine
.
아마도 콘솔이 지워지고있을 것입니다. 시험:
Console.WriteLine("Test");
Console.ReadLine();
그리고 Enter 키를 누를 때까지 그대로 유지됩니다.
Solution Explorer
창 에서 프로젝트를 소유 한 속성으로 이동하여 응용 프로그램 유형을 선택하고 Output Type
값을 찾고 변경하십시오 Console Application
. 그러면 폼 외에 콘솔 화면이 만들어집니다. 콘솔 화면을 닫으면 양식도 닫힙니다.
행운을 빕니다.
만족스러운 답변이 제공되지 않았습니다.
System.Diagnostics.Debug.WriteLine()
출력 : 디버그 창에 메시지를 쓰지만 태양 아래 모든 프로세스에 의해 많은 쓰레기가 지속적으로 해당 창에 덤프됩니다. 마치 건초 더미에서 바늘을 찾아서 메시지를 찾는 것과 같습니다.
Console.WriteLine()
Visual Studio에서 어떤 창에도 쓰지 않습니다. 응용 프로그램이 처음에 콘솔을 만드는 경우, 즉 콘솔 응용 프로그램 인 경우에만 응용 프로그램 콘솔에 쓸 것입니다.
왜 툴링이 웹 애플리케이션 서버 측 코드 .cs 코드가 디버그 메시지를 창에 작성하여 쓰레기로 가득 차서 정보를 찾는 것이 거의 불가능한 이유는 무엇입니까?
또는 CTRL+F5
키를 누를 때까지 마지막 행이 실행 된 후 ConsoleWindow 대기를 열어 디버그 할 수 있습니다 .
네임 스페이스에서 콘솔을 사용했기 때문일 가능성이 높습니다. 예를 들면 다음과 같습니다.
namespace XYZApplication.Console
{
class Program
{
static void Main(string[] args)
{
//Some code;
}
}
}
네임 스페이스에서 제거 하거나 대신 전체 네임 스페이스를 사용하십시오.
System.Console.Writeline("abc");
출력 창은 콘솔이 아닙니다. 방법을 사용해보십시오System.Diagnostics.Debug
Winforms 앱에서 두 가지 방법 :
System.Diagnostics.Debug.WriteLine("my string")
과
System.Console.WriteLine("my string")
출력 창에 씁니다.
AspNetCore 앱에서는 System.Diagnostics.Debug.WriteLine("my string")
출력 창 에만 씁니다.
솔루션 탐색기에서 프로젝트를 마우스 오른쪽 버튼으로 클릭하고 "clean"을 클릭하십시오.
이제 실행 F5
코드가 다음과 같은지 확인하십시오.
Console.WriteLine("TEST");
Console.ReadLine();
I run into a similar problem while running a Unit Test. Console.WriteLine()
did not write anything into the VS Output Window.
Using System.Diagnostics.Debug.WriteLine()
solved the problem.
Try ctrl+F5, it will hold your Screen until you press any key. Regards
If you use Ctrl-F5 (start without debugging) it will leave the console window open with a message "Press any key to continue". That's the easiest way to keep the console window from closing so you can see the console output.
Go to the Debug menu and select Options and uncheck "Redirect all Output Window text to Immediate Window"
Console.Writeline()
shows up in the debug output (Debug => Windows => Output).
If you are developing a command line application, you can also use Console.ReadLine()
at the end of your code to wait for the 'Enter' keypress before closing the console window so that you can read your output.
using System.Diagnostics;
Trace.WriteLine("This line will show on Output window");
Trace.Flush();
This works on Microsoft Team Explorer for Visual Studio 2013
Workaround I found:
Press Ctrl + Alt + I
or navigate to "Debug Tab" ---> "Windows" ---> "Immediate".
In your code write:
Trace.WriteLine("This is one of the workaround");
The Output window of Visual Studio 2017 have a menu called Show output from, in my case ASP.NET Core Web Server was the option to select in order to see the printed out, I came across this issue since I had it set to Build so I wasn't seeing the printed out lines at runtime.
'IT' 카테고리의 다른 글
배열에 shared_ptr : 사용해야합니까? (0) | 2020.06.07 |
---|---|
“npm 구성 세트 레지스트리 https://registry.npmjs.org/”가 Windows bat 파일에서 작동하지 않습니다 (0) | 2020.06.06 |
약 2GB의 텍스트 파일을 어떻게 읽습니까? (0) | 2020.06.06 |
JavaScript 만 사용하여 파일에 데이터를 쓸 수 있습니까? (0) | 2020.06.06 |
텍스트 영역 크기 조정을 비활성화하는 방법은 무엇입니까? (0) | 2020.06.06 |