{"id":684,"date":"2006-04-21T17:40:12","date_gmt":"2006-04-21T17:40:12","guid":{"rendered":"http:\/\/ellery.no-ip.info\/wp\/thinkingmore\/2006\/04\/21\/nant-2\/"},"modified":"2006-04-21T17:40:12","modified_gmt":"2006-04-21T17:40:12","slug":"nant-2","status":"publish","type":"post","link":"https:\/\/ellery.no-ip.info\/wp\/thinkingmore\/2006\/04\/nant-2\/","title":{"rendered":"NAnt (2)"},"content":{"rendered":"<p>\u770b\u5b8c\u4e0a\u4e00\u7bc7\uff0c\u4f60\u5927\u6982\u6703\u60f3\uff0c\u8981\u5beb\u7684 task \u662f\u5982\u6b64\u4e4b\u5c11\uff0c\u9019\u771f\u662f\u592a\u5b8c\u7f8e\u4e86\u3002<br \/>\n\u4f46\u662f\u5c0d\u65bc\u7b28Q\u4f86\u8aaa\uff0c\u4e0d\u5e78\u7684\u4e8b\u60c5\u767c\u751f\u4e86&#8230;<br \/>\n\u7b28Q \u807d\u8aaa .Net \u4e5f\u79fb\u690d\u5230 Linux \u4e0a\u4e86\uff0c\u6240\u4ee5\u4ed6\u60f3\u8a66\u8a66\u770b\u628a\u4e0a\u7bc7\u7684\u7a0b\u5f0f\u62ff\u5230 Linux \u4e0b\u7de8\u8b6f\uff0c\u65bc\u662f\u7b28 Q \u5b89\u88dd\u4e86 Mono\u3002\u63a5\u8457\u5b89\u88dd NAnt\u3002<br \/>\n\u540c\u6a23\u4ed6\u4e0b\u8f09\u4e86 NAnt, \u4e26\u4e14\u89e3\u958b\uff0c\u653e\u5230 \/opt\/nant \u4e0b\u3002<br \/>\n\u518d\u628a\u6574\u500b\u5c08\u6848\u8907\u88fd\u5230 Linux \u4e0b\uff0c\u4e26\u4e14\u4fee\u6539\u4e86\u4e00\u4e0b build \u6a94\u7684\u5167\u5bb9\uff0c\u7531<\/p>\n<blockquote><p>&lt;property name=&#8221;nant.settings.currentframework&#8221; value=&#8221;net-1.1&#8243;\/&gt;<\/p><\/blockquote>\n<p>\u6539\u70ba<\/p>\n<blockquote><p>&lt;property name=&#8221;nant.settings.currentframework&#8221; value=&#8221;mono-1.0&#8243;\/&gt;<\/p><\/blockquote>\n<p>\u8b93 NAnt \u5728\u5efa\u7acb\u5c08\u6848\u524d\u81ea\u52d5\u628a\u7de8\u8b6f\u74b0\u5883\u5207\u63db\u70ba mono\u3002<br \/>\n\u63a5\u8457\u8f38\u5165<br \/>\n$mono \/opt\/nant\/bin\/NAnt.exe<br \/>\n\u9019\u6642\u53ea\u898b NAnt \u5f88\u4e0d\u722d\u6c23\u7684\u5410\u4e86\u4e00\u53e5\uff1a<\/p>\n<blockquote><p>Invalid element &lt;solution&gt;. Unknown task or datatype<\/p><\/blockquote>\n<p>\u7b28Q \u53ea\u80fd\u6d41\u6dda\u9ed8\u9ed8\u63a5\u53d7\u9019\u500b\u4e8b\u5be6\uff0c\u4ed6\u77e5\u9053\u5fc5\u9808\u81ea\u5df1\u5b78\u8457\u5beb target\u3002<\/p>\n<hr \/>\n<p>\u4e00\u500b NAnt \u7684 build \u6a94\u6848\u5176\u5be6\u662f\u4e00\u500b XML \u6a94\u6848\uff0c\u6700\u57fa\u672c\u7684\u5143\u7d20\u662f project\uff0cproject \u5247\u662f\u7531 target \u8207 property \u7d44\u6210\u7684\uff0c\u800c target \u5247\u662f\u7531\u8a31\u591a\u7684 task \u7d44\u6210\u7684\u3002<br \/>\n\u6240\u4ee5\u4e00\u500b\u7a7a\u7684 build \u6a94\u6848\u662f\u9577\u9019\u500b\u6a23\u5b50\uff1a<br \/>\n<font color=\"#800000\"><\/font>&lt;<font color=\"#800000\"><\/font>?xml<font color=\"#FF0000\"> version=<\/font><font color=\"#0000FF\">&quot;1.0&quot;<\/font>?&gt;<font color=\"#800000\"><\/font><br \/><font color=\"#800000\"><\/font>&lt;project<font color=\"#FF0000\"> name=<\/font><font color=\"#0000FF\">&quot;dnsedu&quot;<\/font> default=<font color=\"#800000\"><\/font>&#8220;build&#8221;&gt;<font color=\"#800000\"><\/font> <font color=\"#800000\"><\/font> <font color=\"#800000\"><\/font> <font color=\"#800000\"><\/font> <font color=\"#800000\"><\/font><br \/>&nbsp;&nbsp;&lt;property<font color=\"#FF0000\"> name=<\/font>&#8220;nant.settings.currentframework&#8221;<font color=\"#FF0000\"> value=<\/font>&#8220;net-1.1&#8243;\/<font color=\"#800000\"><\/font>&gt;<font color=\"#800000\"><\/font><br \/>&nbsp;&nbsp;&lt;target<font color=\"#FF0000\"> name=<\/font>&#8220;build&#8221; description=<font color=\"#0000FF\">&quot;Default build target&quot;<\/font> depends=<font color=\"#0000FF\">&quot;dnsedu&quot;<\/font>&gt;<font color=\"#800000\"><\/font><br \/>&nbsp;&nbsp;&lt;<font color=\"#800000\"><\/font>\/target&gt;<font color=\"#800000\"><\/font><br \/><font color=\"#800000\"><\/font>&lt;<font color=\"#800000\"><\/font>\/project&gt;<br \/>\n\u90a3\u9ebc target \u88e1\u9762\u6709\u54ea\u4e9b task \u53ef\u4ee5\u7528\u5462\uff1f\u4f60\u53ef\u4ee5\u53c3\u8003\u5b98\u65b9\u7db2\u7ad9\u7684<a href=\"http:\/\/nant.sourceforge.net\/nightly\/latest\/help\/tasks\/index.html\" title=\"Task Reference\">\u9019\u88e1<\/a>\u3002<br \/>\n\u88e1\u9762\u771f\u7684\u5f88\u591a task\uff0c\u9664\u4e86\u57fa\u672c\u7de8\u8b6f(csc, vbc, cl, al, ilasm, resgen)\u4e4b\u5916\uff0c\u4ed6\u9084\u6709 copy, cvs, mail, nunit &#8230;\u7b49\u7b49\u7684 task\uff0c\u7d55\u5c0d\u53ef\u4ee5\u8b93\u4f60\u7d44\u5408\u51fa\u4f60\u60f3\u8981\u7684\u6771\u897f\u3002<br \/>\n\u8981\u6539\u5beb\u4e0a\u7bc7\u7684 build(\u6211\u5047\u8a2d\u4f60\u7528 c#)\uff0c\u6211\u5011\u6703\u7528\u5230 csc\u3001mkdir \u9019\u5169\u500b\u4e3b\u8981\u7684 task\u3002<br \/>\n\u4ee5\u4e0b\u662f\u6539\u5beb\u597d\u7684 build \u6a94\u6848<br \/>\n&lt;project name=&quot;your_project&quot; default=&quot;build&quot;&gt;<br \/>\n&nbsp;&nbsp;&lt;property name=&quot;nant.settings.currentframework&quot; value=&quot;mono-1.0&quot;\/&gt;<br \/>\n&nbsp;&nbsp;&lt;property name=&quot;debug&quot; value=&quot;false&quot;\/&gt;<br \/>\n&nbsp;&nbsp;&lt;target name=&quot;build&quot;&gt;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&lt;mkdir dir=&quot;bin&quot; unless=&quot;${directory::exists(&#8216;bin&#8217;)}&quot; \/&gt;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&lt;csc target=&quot;winexe&quot; output=&quot;bin\/your_project.exe&quot; debug=&quot;${debug}&quot;&gt;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;sources&gt;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;include name=&quot;*.cs&quot;\/&gt;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;\/sources&gt;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;references&gt;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;include name=&quot;System.Drawing.dll&quot; \/&gt;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;include name=&quot;System.Data.dll&quot; \/&gt;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;include name=&quot;System.Windows.Forms.dll&quot;\/&gt;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;\/references&gt;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;resources&gt;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;include name=&quot;*.resx&quot;\/&gt;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;\/resources&gt;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&lt;\/csc&gt;<br \/>\n&nbsp;&nbsp;&lt;\/target&gt;<br \/>\n&lt;\/project&gt;<br \/>\nmkdir task \u9019\u908a\u6211\u4f7f\u7528\u4e86 unless\uff0c\u610f\u601d\u662f if not\uff0c\u6240\u4ee5\u610f\u601d\u5c31\u662f\u7576\u76ee\u9304\u4e0d\u5b58\u5728\u7684\u6642\u5019\uff0c\u5c31\u5efa\u7acb\u4e00\u500b\u3002\u9019\u88e1\u5224\u65b7\u76ee\u9304\u662f\u5426\u5b58\u5728\u7684\u51fd\u6578\u662f NAnt \u5167\u5efa\u7684\uff0c\u60f3\u77e5\u9053\u6709\u54ea\u4e9b\u51fd\u6578\u53ef\u7528\uff0c\u53ef\u4ee5\u53c3\u8003NAnt\u5b98\u65b9\u7db2\u7ad9\u7684<a href=\"http:\/\/nant.sourceforge.net\/nightly\/latest\/help\/functions\/index.html\" title=\"Function Reference\">\u9019\u908a<\/a>\u3002<br \/>\ncsc task \u88e1\u9762\uff0c\u5247\u9700\u8981\u6307\u5b9a\u8f38\u51fa\u985e\u578b(target)\uff0c\u8f38\u51fa\u6a94\u540d(output)\u4ee5\u53ca\u8981\u4e0d\u8981\u5305\u542b\u9664\u932f\u8cc7\u8a0a(debug)\u3002<br \/>\n\u593e\u5728 &lt;csc&gt;&lt;\/csc&gt; \u88e1\u9762\u7684\uff0c\u5c31\u662f\u6307\u5b9a\u4f60 c# \u7a0b\u5f0f\uff0c\u6240\u5f15\u7528(\u6216\u53c3\u8003)\u5230\u7684\u7d44\u4ef6\u4ee5\u53ca\u6240\u4f7f\u7528\u7684\u8cc7\u6e90\u6a94\u3002<br \/>\n\u5f88\u7c21\u55ae\uff0c\u5c0d\u5427\uff5e<br \/>\n\u9019\u5c31\u662f\u6700\u57fa\u672c\u7684\u56c9\uff0c\u4e0b\u6b21\u6211\u5011\u4f86\u8ac7\u8ac7 web \u61c9\u7528\u7a0b\u5f0f\u7684\u90e8\u4efd\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u770b\u5b8c\u4e0a\u4e00\u7bc7\uff0c\u4f60\u5927\u6982\u6703\u60f3\uff0c\u8981\u5beb\u7684 task \u662f\u5982\u6b64\u4e4b\u5c11\uff0c\u9019\u771f\u662f\u592a\u5b8c\u7f8e\u4e86\u3002 \u4f46\u662f\u5c0d\u65bc\u7b28Q\u4f86\u8aaa\uff0c\u4e0d\u5e78\u7684\u4e8b\u60c5\u767c\u751f\u4e86&#8230; \u7b28Q \u807d\u8aaa .Net \u4e5f\u79fb\u690d\u5230 Linux \u4e0a\u4e86\uff0c\u6240\u4ee5\u4ed6\u60f3\u8a66\u8a66\u770b\u628a\u4e0a\u7bc7\u7684\u7a0b\u5f0f\u62ff\u5230 Linux \u4e0b\u7de8\u8b6f\uff0c\u65bc\u662f\u7b28 Q \u5b89\u88dd\u4e86 Mono\u3002\u63a5\u8457\u5b89\u88dd NAnt\u3002 \u540c\u6a23\u4ed6\u4e0b\u8f09\u4e86 NAnt, \u4e26\u4e14\u89e3\u958b\uff0c\u653e\u5230 \/opt\/nant \u4e0b\u3002 \u518d\u628a\u6574\u500b\u5c08\u6848\u8907\u88fd\u5230 Linux \u4e0b\uff0c\u4e26\u4e14\u4fee\u6539\u4e86\u4e00\u4e0b build \u6a94\u7684\u5167\u5bb9\uff0c\u7531 &lt;property name=&#8221;nant.settings.currentframework&#8221; value=&#8221;net-1.1&#8243;\/&gt; \u6539\u70ba &lt;property name=&#8221;nant.settings.currentframework&#8221; value=&#8221;mono-1.0&#8243;\/&gt; \u8b93 NAnt \u5728\u5efa\u7acb\u5c08\u6848\u524d\u81ea\u52d5\u628a\u7de8\u8b6f\u74b0\u5883\u5207\u63db\u70ba mono\u3002 \u63a5\u8457\u8f38\u5165 $mono \/opt\/nant\/bin\/NAnt.exe \u9019\u6642\u53ea\u898b NAnt \u5f88\u4e0d\u722d\u6c23\u7684\u5410\u4e86\u4e00\u53e5\uff1a Invalid element &lt;solution&gt;. Unknown task or datatype \u7b28Q \u53ea\u80fd\u6d41\u6dda\u9ed8\u9ed8\u63a5\u53d7\u9019\u500b\u4e8b\u5be6\uff0c\u4ed6\u77e5\u9053\u5fc5\u9808\u81ea\u5df1\u5b78\u8457\u5beb target\u3002 \u4e00\u500b NAnt &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/ellery.no-ip.info\/wp\/thinkingmore\/2006\/04\/nant-2\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;NAnt (2)&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[6],"tags":[],"class_list":["post-684","post","type-post","status-publish","format-standard","hentry","category-net"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p2MOxp-b2","_links":{"self":[{"href":"https:\/\/ellery.no-ip.info\/wp\/thinkingmore\/wp-json\/wp\/v2\/posts\/684","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ellery.no-ip.info\/wp\/thinkingmore\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ellery.no-ip.info\/wp\/thinkingmore\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ellery.no-ip.info\/wp\/thinkingmore\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ellery.no-ip.info\/wp\/thinkingmore\/wp-json\/wp\/v2\/comments?post=684"}],"version-history":[{"count":0,"href":"https:\/\/ellery.no-ip.info\/wp\/thinkingmore\/wp-json\/wp\/v2\/posts\/684\/revisions"}],"wp:attachment":[{"href":"https:\/\/ellery.no-ip.info\/wp\/thinkingmore\/wp-json\/wp\/v2\/media?parent=684"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ellery.no-ip.info\/wp\/thinkingmore\/wp-json\/wp\/v2\/categories?post=684"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ellery.no-ip.info\/wp\/thinkingmore\/wp-json\/wp\/v2\/tags?post=684"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}