1
0

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.

IDEなしでC#のHelloWorld

Last updated at Posted at 2019-12-04

VisualStudioなどのIDEなしでC#のHelloWorldやってみます。

好きなところにソースコードを用意します。

ファイル名: helloworld.cs

using System;
public static class HelloWorld
{
  public static void Main()
  {
    Console.WriteLine("Hello C#!");
  }
}

ソースコードをコンパイルしてexe形式にします。

C#の環境を確認

.NET Frameworkがインストールされていれば以下の場所にバージョンごとの.NET Frameworkが存在します。

32bit Windowsの場合
%windir%\Microsoft.NET\Framework

64bit Windowsの場合
%windir%\Microsoft.NET\Framework64

こんな感じ
image.png

バージョンのディレクトリの配下にcsc.exeというコンパイラが存在します。
image.png

コンパイルしてみる

> C:\Windows\Microsoft.NET\Framework64\v4.0.30319\csc.exe helloworld.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

image.png

コンパイルエラーはこんな感じに出ます。

helloworld.cs(6,35): error CS1002: ; が必要です。

exe実行してみる

> .\helloworld.exe
Hello C#!
1
0
0

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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?