次のC#プログラム(で作成csc hello.cs)Hello via Console!は、コンソールとHello via OutputDebugStringDebugViewウィンドウにのみ印刷されます。ただし、どちらのSystem.Diagnostics.*呼び出しも表示されません。何故ですか?
using System;
using System.Runtime.InteropServices;
class Hello {
[DllImport("kernel32.dll", CharSet=CharSet.Auto)]
public static extern void OutputDebugString(string message);
static void Main() {
Console.Write( "Hello via Console!" );
System.Diagnostics.Debug.Write( "Hello via Debug!" );
System.Diagnostics.Trace.Write( "Hello via Trace!" );
OutputDebugString( "Hello via OutputDebugString" );
}
}
おそらくいくつかの特別なコマンドラインスイッチが必要ですcscか?
私は開発にVisual Studioを使用していません。これは純粋なコマンドラインのものです。