先準備環境:
執行
sudo apt-get install gcc
先安裝:libgdiplus
下載: http://ftp.novell.com/pub/mono/sources/libgdiplus/libgdiplus-2.8.1.tar.bz2
解壓tar -jvxf libgdiplus-2.81.tar.bz2
進入目錄:cd libgdiplus-2.8。1
執行:./configure --prefix=/usr 有可能遇到的錯誤 有:
錯誤解決:
Error: you need to install pkg-config
執行:sudo apt-get install pkg-config
No package 'glib-2.0' found
執行:sudo apt-get install libglib2.0-dev
Error: *** Pibpng12 not found
執行:sudo apt-get install libpng-dev
Error:"Failed to compile with X11/Xlib.h include"
執行:sudo apt-get install libx11-dev
Error:cairo requires at least one font backend.please install freetype and fontconfig.
Error:./configure failed for cairo
執行:
sudo apt-get install libfreetype6-dev
sudo apt-get install fontconfig
sudo apt-get install libfontconfig1-dev
以上的也許有些不一定需要。。但我是全給它裝了
解決以上問題 執行./configure --prefix=/usr基本沒問題 了。如果還有可以用
Sudo apt-cache search 查詢需要安裝的庫
最后執行make && make install安裝即可
最后安裝mono
執行:cd ..
回到上層目錄,
下載:http://ftp.novell.com/pub/mono/sources/mono/mono-2.8.1.tar.bz2
解壓:tar -jvxf mono-2.8.1.tar.bz2
進入解壓的目錄:cd mono-2.8.1
執行:./configure --prefix=/usr
可能出現的錯誤有:
Error:you need to install g++
執行:sudo apt-get install g++
Error:you need to install bison
Sudo apt-get install bison
Error:msgfmt not found.you need to install the "gettext" package
Sudo apt-get install gettext
解決以上問題 執行./configure --prefix=/usr
最后執行make && make install安裝即可(編譯時間比較久)
執行:mono -V就可以查看當前版本

最后測試下,在VS2010下寫了個控制臺程 序,編 譯生成EXE拷貝到ubuntu下
- static void Main(string[] args)
- {
- var p = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName;
- Console.WriteLine(p);
- p = Environment.CurrentDirectory;
- Console.WriteLine(p);
- var fs = System.IO.Directory.GetFiles(p);
- foreach (var f in fs)
- {
- Console.WriteLine(f);
- }
- p = JM.Common.IO.PathMg.CheckPath("abc");
- Console.WriteLine(p);
- p = System.Windows.Forms.Application.StartupPath;
- Console.WriteLine(p);
- Console.WriteLine("請輸入您要創建的目錄:");
- var dic = Console.ReadLine();
- p = JM.Common.IO.PathMg.CheckPath(dic);
- Console.WriteLine("創建目錄:" + p);
- JM.Common.IO.DirectoryMg.CreateDirectory(p);
- Console.WriteLine("創建完成");
- Console.ReadLine();
- }

執行結果除了中文顯示不了之外其它的都沒有問題 ,我裝的是英文版操作系統。
.png)