mono Hello World をコンパイルするにはどうすればいいですか?

mono Hello World をコンパイルするにはどうすればいいですか?

私は次のモノを搭載した Ubuntu 11.04 を持っています:

Mono JIT compiler version 2.6.7 (Debian 2.6.7-5ubuntu3)
Copyright (C) 2002-2010 Novell, Inc and Contributors. www.mono-project.com
    TLS:           __thread
    GC:            Included Boehm (with typed GC and Parallel Mark)
    SIGSEGV:       altstack
    Notifications: epoll
    Architecture:  x86
    Disabled:      none

これを実行しようとしています:

using System;

public class HelloWorld
{
    static public void Main ()
    {
        Console.WriteLine ("Hello Mono World");
    }
}

そして、次のようなエラーが発生します:

ThinkPad-X201-Tablet:~/Desktop$ gmcs hello.cs
** (/usr/lib/mono/2.0/gmcs.exe:9128): WARNING **: Missing method .ctor in assembly /usr/lib/mono/2.0/gmcs.exe, type System.Runtime.CompilerServices.CompilerGeneratedAttribute
** (/usr/lib/mono/2.0/gmcs.exe:9128): WARNING **: The class System.Runtime.CompilerServices.CompilerGeneratedAttribute could not be loaded, used in gmcs
** (/usr/lib/mono/2.0/gmcs.exe:9128): WARNING **: Can't find custom attr constructor image: /usr/lib/mono/2.0/gmcs.exe mtoken: 0x0a0003d2
** (/usr/lib/mono/2.0/gmcs.exe:9128): WARNING **: Missing method .ctor in assembly /usr/lib/mono/2.0/gmcs.exe, type System.Runtime.CompilerServices.CompilerGeneratedAttribute
** (/usr/lib/mono/2.0/gmcs.exe:9128): WARNING **: Can't find custom attr constructor image: /usr/lib/mono/2.0/gmcs.exe mtoken: 0x0a0003d2
** (/usr/lib/mono/2.0/gmcs.exe:9128): WARNING **: Missing method .ctor in assembly /usr/lib/mono/2.0/gmcs.exe, type System.Runtime.CompilerServices.CompilerGeneratedAttribute
** (/usr/lib/mono/2.0/gmcs.exe:9128): WARNING **: Can't find custom attr constructor image: /usr/lib/mono/2.0/gmcs.exe mtoken: 0x0a0003d2
** (/usr/lib/mono/2.0/gmcs.exe:9128): WARNING **: Missing method .ctor in assembly /usr/lib/mono/2.0/gmcs.exe, type System.Runtime.CompilerServices.CompilerGeneratedAttribute
** (/usr/lib/mono/2.0/gmcs.exe:9128): WARNING **: Can't find custom attr constructor image: /usr/lib/mono/2.0/gmcs.exe mtoken: 0x0a0003d2
** (/usr/lib/mono/2.0/gmcs.exe:9128): WARNING **: Missing method .ctor in assembly /usr/lib/mono/2.0/gmcs.exe, type System.Runtime.CompilerServices.CompilerGeneratedAttribute
** (/usr/lib/mono/2.0/gmcs.exe:9128): WARNING **: Can't find custom attr constructor image: /usr/lib/mono/2.0/gmcs.exe mtoken: 0x0a0003d2
** (/usr/lib/mono/2.0/gmcs.exe:9128): WARNING **: Missing method .ctor in assembly /usr/lib/mono/2.0/gmcs.exe, type System.Runtime.CompilerServices.CompilerGeneratedAttribute
** (/usr/lib/mono/2.0/gmcs.exe:9128): WARNING **: Can't find custom attr constructor image: /usr/lib/mono/2.0/gmcs.exe mtoken: 0x0a0003d2
** (/usr/lib/mono/2.0/gmcs.exe:9128): WARNING **: Missing method .ctor in assembly /usr/lib/mono/2.0/gmcs.exe, type System.Runtime.CompilerServices.CompilerGeneratedAttribute
** (/usr/lib/mono/2.0/gmcs.exe:9128): WARNING **: Can't find custom attr constructor image: /usr/lib/mono/2.0/gmcs.exe mtoken: 0x0a0003d2
Unhandled Exception: System.TypeLoadException: A type load exception has occurred.

何か案は?

答え1

私のセットアップでは問題なくコンパイルされます。

次のパッケージをインストールする必要があります:

  • モノ-2.0-開発

これにより、コマンド ライン コンパイルに必要なすべての依存関係が描画されます。より快適に作業したい場合は、monodevelop パッケージをインストールすることをお勧めします。

関連情報