トップQs
タイムライン
チャット
視点
Csc.exe
ウィキペディアから
Remove ads
csc.exeは、.NET Frameworkに含まれるマイクロソフト製のC#コンパイラである。.NET FrameworkはWindowsに標準で搭載されているため、開発環境がなくてもプログラミングをすることができる。ただし、ユーザー補助機能はほとんどない。
![]() | この記事には複数の問題があります。 |

利用例
hello.csというファイル名で以下のコードを保存するとする。
using System;
class Program{
static void Main(){
Console.WriteLine("Hello,world!");
}
}
hello.csを保存し終わった後に、コマンドプロンプトから以下を入力する。
> csc hello.cs
このコマンドを実行すると、以下のようなログが出力される。
Microsoft (R) Visual C# Compiler version 4.8.3752.0
for C# 5
Copyright (C) Microsoft Corporation. All rights reserved.
This compiler is provided as part of the Microsoft (R) .NET Framework, but only supports language versions up to C# 5, which is no longer the latest version. For compilers that support newer versions of the C# programming language, see http://go.microsoft.com/fwlink/?LinkID=533240
エラーや警告がある場合は、このログの下に出力される。
Remove ads
主なオプション
ビルドのターゲット
/target オプションを使用することによって、特定の形式でアセンブリを作成できる。
ライブラリ
library.csがライブラリのデータを含むソースコードであることとする。
> csc /target:library library.cs
GUIアプリケーション
window.csがフォームオブジェクトのデータを含むソースコードであることとする。
> csc /target:winexe window.cs
著作権を表示しない
/nologo オプションを使用することで、コンパイル時の著作権表示を消すことができる。
> csc /nologo hello.cs
ヘルプ
/help オプションもしくは /? オプションで、csc.exeの使用できるオプションを出力させられる。
> csc /help
出典
関連項目
外部リンク
Wikiwand - on
Seamless Wikipedia browsing. On steroids.
Remove ads