2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

コマンドプロンプトからC#をコンパイル

Last updated at Posted at 2018-09-10

C#コンパイラ(csc.exe)をC:\Windows\Microsoft.NETから検索する。
where /r C:\Windows\Microsoft.NET csc.exe
csc1.png
以下のようなバッチファイルを用意し実行する。

dev.bat
@echo off
path %path%;C:\Windows\Microsoft.NET\Framework\v4.0.30319
cmd

コンパイルと実行例。

hello.cs
// csc hello.cs

using System;
using System.Runtime.InteropServices;

class Program {
	[DllImport("user32.dll")]
	private extern static int MessageBox(
		uint hWnd, string lpText, string lpCaption, uint uType);

	static void Main() {
		MessageBox(0, "hello, world", "hello", 0x40);
	}
}

hello.png

2
1
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?