概要
UbuntuでC#の開発をしたかったのでHello Worldしたメモ。
以下の記事を参考に自分で試してみたメモなので、これらの記事以上の内容はありません。
- https://qiita.com/maccha_XD/items/248563d296dee0ab9cc7
- https://qiita.com/LemonLeaf/items/0531f5479315ee858eb9
- https://qiita.com/matsuda_sinsuke/items/76068f4c396887459803
環境
$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.3 LTS"
Install Mono
$ sudo apt -y install mono-devel
$ mono --version
Mono JIT compiler version 4.6.2 (Debian 4.6.2.7+dfsg-1ubuntu1)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
TLS: __thread
SIGSEGV: altstack
Notifications: epoll
Architecture: amd64
Disabled: none
Misc: softdebug
LLVM: supported, not enabled.
GC: sgen
$ mcs --version
Mono C# compiler version 4.6.2.0
Ubuntu18.04でC# Hello World
HelloWorld.cs
using System;
public class HelloWorld {
public static void Main() {
Console.WriteLine("hello world!");
}
}
$ mcs ./HelloWorld.cs
$ ls
HelloWorld.cs HelloWorld.exe
$ mono ./HelloWorld.exe
hello world!
$ ./HelloWorld.exe
hello world!
まとめ
Monoを使えばUbuntuでC#の開発ができそう