{"id":249,"date":"2019-07-20T21:15:11","date_gmt":"2019-07-20T13:15:11","guid":{"rendered":"http:\/\/www.mustenaka.cn\/?p=249"},"modified":"2019-07-20T21:24:34","modified_gmt":"2019-07-20T13:24:34","slug":"linuxinstallmono","status":"publish","type":"post","link":"https:\/\/www.mustenaka.cn\/index.php\/2019\/07\/20\/linuxinstallmono\/","title":{"rendered":"linux\u4e0a\u5b89\u88c5mono\u4e0eC#"},"content":{"rendered":"<p>\u53c2\u8003mono\u5b98\u7f51\u7684\u6587\u732e\uff1a<a href=\"https:\/\/www.mono-project.com\/download\/stable\/#download-lin\">https:\/\/www.mono-project.com\/download\/stable\/#download-lin<\/a><\/p>\n<p>\u540c\u65f6\u53c2\u8003\u8fd9\u4e2a\u8001\u54e5\u7684\u6587\u7ae0\uff1a<a href=\"https:\/\/blog.csdn.net\/lansetiankong12\/article\/details\/48243653\">https:\/\/blog.csdn.net\/lansetiankong12\/article\/details\/48243653<\/a><\/p>\n<p>\u672c\u6587\u5c06\u5f15\u5bfc\u4f60\u5728linux\u7cfb\u7edf\u4e0b\u5b89\u88c5C#\u4e0emono\uff0c\u8fd9\u4e9b\u4e1c\u897f\u6e90\u81ea\u4e8eWINDOWS\uff0c\u540e\u5fae\u8f6f\u65f6\u4ee3\u62e5\u62b1\u5f00\u6e90\u624d\u9010\u6e10\u5f15\u5165linux\u4e2d\u5230\u5168\u5e73\u53f0\u8fd0\u884c\u3002<\/p>\n<p><!--more--><\/p>\n<p>Ubuntu18.04\u7cfb\u5217\u5305\u62ec\u672c\u4eba\u7684elementary OS 5.0 \u4e5f\u5c5e\u4e8eUbuntu18.04\uff0c\u76f4\u63a5\u6253\u5f00\u7ec8\u7aef\u8f93\u5165\uff1a<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"\" bash=\"\">sudo apt install gnupg ca-certificates\r\nsudo apt-key adv --keyserver hkp:\/\/keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF\r\necho \"deb https:\/\/download.mono-project.com\/repo\/ubuntu stable-bionic main\" | sudo tee \/etc\/apt\/sources.list.d\/mono-official-stable.list\r\nsudo apt update<\/code><\/pre>\n<p>Ubuntu16.04\u7cfb\u5217\u7cfb\u7edf\uff0c\u5305\u62ecelementary OS 4.0\u5219\u4f7f\u7528\u4e0b\u9762\u7684\u547d\u4ee4\uff1a<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"\" bash=\"\">sudo apt-key adv --keyserver hkp:\/\/keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF\r\nsudo apt install apt-transport-https ca-certificates\r\necho \"deb https:\/\/download.mono-project.com\/repo\/ubuntu stable-xenial main\" | sudo tee \/etc\/apt\/sources.list.d\/mono-official-stable.list\r\nsudo apt update<\/code><\/pre>\n<p>\u8fd9\u4e9b\u6b65\u9aa4\u7684\u91cd\u70b9\u5c31\u662f\u4e3a\u6211\u4eec\u6dfb\u52a0mono\u7684\u8f6f\u4ef6\u6e90\uff0c\u5728\u6dfb\u52a0\u5b8c\u6210\u540e\uff0c\u6211\u4eec\u8f93\u5165<span class=\"hljs-built_in\">sudo<\/span><span> apt install mono-devel \u4ee5\u5b89\u88c5\u7f16\u8bd1\u5668\uff08\u6ce8\u610f\uff0c\u662f\u7f16\u8bd1\u5668\uff0c\u5e76\u975eIDE\uff09<\/span><\/p>\n<p>\u6b64\u5916\u8fd8\u6709\u4e00\u4e9b\u5176\u4ed6\u7684\u547d\u4ee4\uff0c\u8fd9\u91cc\u6309\u7167\u81ea\u5df1\u7684\u7406\u89e3\u7b80\u5355\u505a\u4e00\u4e2a\u4ecb\u7ecd\uff08\u8bf7\u76f4\u63a5\u770b\u82f1\u6587\uff09\uff1a<\/p>\n<blockquote><p>The package <b>mono-devel <\/b>should be installed to compile code.<\/p>\n<p>The package <b>mono-complete <\/b>should be installed to install everything &#8211; this should cover most cases of &#8220;assembly not found&#8221; errors.<\/p>\n<p>The package <b>mono-dbg <\/b>should be installed to get debugging symbols for framework libraries &#8211; allowing you to get line numbers in stack traces.<\/p>\n<p>The package <b>referenceassemblies-pcl <\/b>should be installed for PCL compilation support &#8211; this will resolve most cases of &#8220;Framework not installed: .NETPortable&#8221; errors during software compilation.<\/p>\n<p>The package <b>ca-certificates-mono <\/b>should be installed to get SSL certificates for HTTPS connections. Install this package if you run into trouble making HTTPS connections.<\/p>\n<p>The package <b>mono-xsp4 <\/b>should be installed for running ASP.NET applications.<\/p><\/blockquote>\n<blockquote><p><strong>mono-devel \uff1a\u00a0<\/strong>\u5c06\u4f1a\u5b89\u88c5\u5b8c\u6574\u7684C#\u6838\u5fc3\u4ee3\u7801\uff0c\u53ea\u662f\u57fa\u7840\u7684\u5f00\u53d1\u529f\u80fd<\/p>\n<p><strong>mono-complete<\/strong> \uff1a\u4e0edevel\u4e0d\u540c\uff0c\u5c06\u4f1a\u66f4\u52a0\u5168\u9762\u7684\u5b89\u88c5\u6838\u5fc3\u7ec4\u5efa\uff0c\u8fd9\u4f1a\u89e3\u51b3\u5927\u591a\u6570\u7684\u201c\u672a\u627e\u5230\u7a0b\u5e8f\u96c6\u201d\u7684\u60c5\u51b5(\u672c\u4eba\u9996\u63a8\u5b89\u88c5\u8fd9\u4e2a)<\/p>\n<p>mono-dbg\uff1a\u5c06\u4f1a\u5b89\u88c5debugging\u6307\u4ee4\uff0c\u6709\u52a9\u4e8e\u8c03\u8bd5<\/p>\n<p><b>referenceassemblies-pcl <\/b>\uff1a\u5e94\u5b89\u88c5\u7528\u4e8ePCL\u7f16\u8bd1\u652f\u6301 &#8211; \u8fd9\u5c06\u89e3\u51b3\u8f6f\u4ef6\u7f16\u8bd1\u671f\u95f4\u201cFramework\u672a\u5b89\u88c5\uff1a.NETPortable\u201d\u9519\u8bef\u7684\u5927\u591a\u6570\u60c5\u51b5\u3002<\/p>\n<p><b>ca-certificates-mono<\/b>\uff1a\u83b7\u53d6HTTPS\u8fde\u63a5\u7684SSL\u8bc1\u4e66\u3002 \u5982\u679c\u60a8\u5728\u8fdb\u884cHTTPS\u8fde\u63a5\u65f6\u9047\u5230\u95ee\u9898\uff0c\u8bf7\u5b89\u88c5\u6b64\u8f6f\u4ef6\u5305\uff0cweb\u5f00\u53d1\u8bf7\u5b89\u88c5\u6b64\u3002<\/p>\n<p><b>mono-xsp4 \uff1a<\/b>\u4ee5\u8fd0\u884cASP.NET\u5e94\u7528\u7a0b\u5e8f\u3002<\/p><\/blockquote>\n<p>\u672c\u4eba\u4e5f\u63a8\u8350\u5168\u90e8\u5b89\u88c5\uff0c\u56e0\u6b64\u76f4\u63a5\u590d\u5236\u547d\u4ee4\u5230\u7ec8\u7aef\u5373\u53ef\uff1a<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"\" bash=\"\">sudo apt-get install mono-devel mono-complete mono-dbg referenceassemblies-pcl ca-certificates-mono\u00a0mono-xsp4 <\/code><\/pre>\n<p>\u5b89\u88c5\u5b8c\u6210\u4e4b\u540e\uff0c\u4f9d\u65e7\u6ca1\u6709\u56fe\u5f62\u754c\u9762\uff0c\u4e0d\u8fc7\u5728\u6211\u4eec\u5b89\u88c5\u56fe\u5f62\u754c\u9762\u4e4b\u524d\u8981\u5148\u786e\u5b9a\u53ef\u4ee5\u7f16\u8bd1\u8fd0\u884ccs\u6587\u4ef6\u3002<\/p>\n<p>\u627e\u4e00\u4e2a\u4f60\u4efb\u4f55\u5408\u9002\u7684\u4f4d\u7f6e\u5199\u4e00\u4e2ahelloworld\u4ee3\u7801\uff1a<\/p>\n<p>\u521b\u5efa\u6587\u4ef6<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"\" bash=\"\">touch hello.cs<\/code><\/pre>\n<p>\u7f16\u5199\u4ee3\u7801\uff08\u6ce8\u610f\uff0cC#\u4e0eJAVA\u7565\u6709\u4e0d\u540c\uff0cCS\u5728\u81ea\u5df1\u6d4b\u8bd5\u7684\u65f6\u5019\u6ca1\u5fc5\u8981class\u540d\u4e0e\u6587\u4ef6\u540d\u4e00\u81f4\uff09\u3010PS\uff1a\u4f46\u517b\u6210\u6587\u4ef6\u540d\u4e0e\u7c7b\u540d\u4e00\u81f4\u662f\u4e00\u4e2a\u5f00\u53d1\u7684\u597d\u4e60\u60ef\u3011<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"\" cs=\"\">class X{\r\n    static void Main(string[] arg)\r\n    {   \r\n        System.Console.Write(\"This is C sharp test\");\r\n    }   \r\n}<\/code><\/pre>\n<p>\u4f7f\u7528msc\u547d\u4ee4\u8fdb\u884c\u7f16\u8bd1\u3002<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"\" bash=\"\">msc hello.cs<\/code><\/pre>\n<p><span>mcs\u662fMono\u7684C#\u547d\u4ee4\u884c\u7f16\u8bd1\u5668\u3002\u4e0eMS .NET SDK\u7684csc\u7f16\u8bd1\u5668\u76f8\u4f3c\uff0cmcs\u4e5f\u6709\u5f88\u591a\u547d\u4ee4\u884c\u9009\u9879\u3002\u4e0a\u9762\u7684\u547d\u4ee4\u5c06\u751f\u6210\u53ef\u6267\u884c\u6587\u4ef6hello.exe\u3002\u6ce8\u610f\u8fd9\u4e2a\u6267\u884c\u6587\u4ef6\u4e0d\u662fLinux\u6267\u884c\u6587\u4ef6\uff0c\u800c\u662f\u4e00\u4e2a.NET\u6267\u884c\u6587\u4ef6\uff0c\u6216\u8005\u8bf4\uff0c\u8fd9\u4e2a\u6587\u4ef6\u7684\u53ef\u6267\u884c\u4ee3\u7801\u5f62\u5f0f\u662f\u4e2d\u95f4\u8bed\u8a00\uff08IL\uff0cIntermediate Language\uff09\u3002\u8981\u8fd0\u884c\u8fd9\u4e2a\u6267\u884c\u6587\u4ef6\uff0c\u5fc5\u987b\u6267\u884c\u5982\u4e0b\u547d\u4ee4\uff1a<\/span><\/p>\n<pre class=\"pure-highlightjs\"><code class=\"\" bash=\"\">mono hello.exe<\/code><\/pre>\n<p>\u3010PS\uff1a\u672c\u4eba\u8fd8\u672a\u6d4b\u8bd5\u8fd9\u4e2a\u6587\u4ef6\u53ef\u4ee5\u76f4\u63a5\u5728windows\u8fd0\u884c\u5426\u3011<\/p>\n<p>\u5982\u679c\u7ec8\u7aef\u4e2d\u663e\u793a\u6587\u4ef6\uff0c\u90a3\u5c31\u8bf4\u660e\u5b89\u88c5\u6210\u529f\uff0c\u73b0\u5728\u5c31\u5269\u4e0bIDE\u6ca1\u6709\u5b89\u88c5\u4e86\u3002<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"\" bash=\"\">sudo apt-get install monodevelop <\/code><\/pre>\n<p>\u4e4b\u540eapplications\u4f1a\u591a\u51fa\u4e24\u4e2a\u5e94\u7528\uff0c\u4e00\u4e2a\u662fMonoDevelop IDE\uff0c\u4e00\u4e2a\u5219\u662fMono Ducumentation\uff0c\u6253\u5f00IDE\uff0c\u5df2\u7ecf\u5927\u529f\u544a\u6210\u4e86<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u53c2\u8003mono\u5b98\u7f51\u7684\u6587\u732e\uff1ahttps:\/\/www.mono-project.com\/download\/ [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[44,43],"tags":[33],"class_list":["post-249","post","type-post","status-publish","format-standard","hentry","category-csharp","category-programming-language","tag-c"],"views":2112,"_links":{"self":[{"href":"https:\/\/www.mustenaka.cn\/index.php\/wp-json\/wp\/v2\/posts\/249","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mustenaka.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.mustenaka.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.mustenaka.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mustenaka.cn\/index.php\/wp-json\/wp\/v2\/comments?post=249"}],"version-history":[{"count":3,"href":"https:\/\/www.mustenaka.cn\/index.php\/wp-json\/wp\/v2\/posts\/249\/revisions"}],"predecessor-version":[{"id":252,"href":"https:\/\/www.mustenaka.cn\/index.php\/wp-json\/wp\/v2\/posts\/249\/revisions\/252"}],"wp:attachment":[{"href":"https:\/\/www.mustenaka.cn\/index.php\/wp-json\/wp\/v2\/media?parent=249"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.mustenaka.cn\/index.php\/wp-json\/wp\/v2\/categories?post=249"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.mustenaka.cn\/index.php\/wp-json\/wp\/v2\/tags?post=249"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}