{"id":24243,"date":"2024-05-27T15:40:55","date_gmt":"2024-05-27T07:40:55","guid":{"rendered":"https:\/\/www.yimenyun.cn\/emen\/?p=24243"},"modified":"2024-05-27T15:40:55","modified_gmt":"2024-05-27T07:40:55","slug":"xamarin%e6%89%93%e5%8c%85%e6%88%90exe%e6%93%8d%e4%bd%9c%e6%ad%a5%e9%aa%a4%e4%bb%8b%e7%bb%8d","status":"publish","type":"post","link":"https:\/\/www.yimenyun.cn\/emen\/24243\/","title":{"rendered":"xamarin\u6253\u5305\u6210exe\u64cd\u4f5c\u6b65\u9aa4\u4ecb\u7ecd"},"content":{"rendered":"

Xamarin\u662f\u4e00\u6b3e\u8de8\u5e73\u53f0\u79fb\u52a8\u5e94\u7528\u5f00\u53d1\u6846\u67b6\uff0c\u53ef\u4ee5\u4f7f\u7528C#\u8bed\u8a00\u5f00\u53d1iOS\u548cAndroid\u5e94\u7528\u3002\u5728\u4f7f\u7528Xamarin\u5f00\u53d1\u5e94\u7528\u65f6\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528Visual Studio\u6216Xamarin Studio\u8fdb\u884c\u5f00\u53d1\u3002\u4f46\u662f\uff0c\u5982\u679c\u6211\u4eec\u60f3\u8981\u5c06Xamarin\u5e94\u7528\u6253\u5305\u6210exe\u6587\u4ef6\uff0c\u8be5\u600e\u4e48\u505a\u5462\uff1f<\/p>\n

Xamarin\u5e94\u7528\u6253\u5305\u6210exe\u6587\u4ef6\u7684\u539f\u7406\u662f\u4f7f\u7528\u4e86Mono\u6846\u67b6\uff0c\u5b83\u662f\u4e00\u4e2a\u8de8\u5e73\u53f0\u7684\u5f00\u6e90\u6846\u67b6\uff0c\u53ef\u4ee5\u5728Windows\u3001Linux\u548cMac\u7b49\u5e73\u53f0\u4e0a\u8fd0\u884c\u3002Mono\u6846\u67b6\u4e2d\u5305\u542b\u4e86\u4e00\u4e2a\u540d\u4e3amkbundle\u7684\u5de5\u5177\uff0c\u53ef\u4ee5\u5c06Mono\u5e94\u7528\u6253\u5305\u6210\u4e00\u4e2a\u72ec\u7acb\u7684\u53ef\u6267\u884c\u6587\u4ef6\u3002<\/p>\n

\u4ee5\u4e0b\u662f\u5c06Xamarin\u5e94\u7528\u6253\u5305\u6210exe\u6587\u4ef6\u7684\u8be6\u7ec6\u4ecb\u7ecd\uff1a<\/p>\n

<\/figure>\n<\/p>\n

1. \u5b89\u88c5Mono\u6846\u67b6<\/p>\n

\u5728\u6253\u5305Xamarin\u5e94\u7528\u4e4b\u524d\uff0c\u9700\u8981\u5148\u5b89\u88c5Mono\u6846\u67b6\u3002\u53ef\u4ee5\u4eceMono\u5b98\u7f51\u4e0b\u8f7d\u6700\u65b0\u7248\u672c\u7684Mono\u6846\u67b6\uff0c\u5e76\u6309\u7167\u63d0\u793a\u8fdb\u884c\u5b89\u88c5\u3002<\/p>\n

2. \u6253\u5305Xamarin\u5e94\u7528<\/p>\n

\u4f7f\u7528mkbundle\u5de5\u5177\u6253\u5305Xamarin\u5e94\u7528\uff0c\u9700\u8981\u4f7f\u7528\u547d\u4ee4\u884c\u8fdb\u884c\u64cd\u4f5c\u3002\u5728Windows\u7cfb\u7edf\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528cmd\u547d\u4ee4\u884c\u5de5\u5177\uff1b\u5728Linux\u548cMac\u7cfb\u7edf\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528\u7ec8\u7aef\u5de5\u5177\u3002<\/p>\n

\u547d\u4ee4\u683c\u5f0f\u5982\u4e0b\uff1a<\/p>\n

mkbundle -o [output_file_name] [input_file_name] –deps<\/p>\n

\u5176\u4e2d\uff0coutput_file_name\u4e3a\u8f93\u51fa\u6587\u4ef6\u540d\uff0cinput_file_name\u4e3a\u8f93\u5165\u6587\u4ef6\u540d\u3002–deps\u53c2\u6570\u7528\u4e8e\u81ea\u52a8\u89e3\u51b3\u4f9d\u8d56\u5173\u7cfb\u3002<\/p>\n

\u4f8b\u5982\uff0c\u5c06\u540d\u4e3aMyApp\u7684Xamarin\u5e94\u7528\u6253\u5305\u6210exe\u6587\u4ef6\uff0c\u547d\u4ee4\u5982\u4e0b\uff1a<\/p>\n

mkbundle -o MyApp.exe MyApp.exe –deps<\/p>\n

\u6267\u884c\u547d\u4ee4\u540eexe\u5c01\u5305\u8f6f\u4ef6<\/a>\uff0c\u4f1a\u751f\u6210\u4e00\u4e2a\u540d\u4e3aMyApp.exe\u7684\u53ef\u6267\u884c\u6587\u4ef6\u3002<\/p>\n

3. \u8fd0\u884cexe\u6587\u4ef6<\/p>\n

\u751f\u6210\u7684exe\u6587\u4ef6\u53ef\u4ee5\u76f4\u63a5\u5728Windows\u7cfb\u7edf\u4e2d\u8fd0\u884c\uff0c\u4e5f\u53ef\u4ee5\u5728Linux\u548cMac\u7cfb\u7edf\u4e2d\u901a\u8fc7Mono\u8fd0\u884c\u3002\u5728Linux\u548cMac\u7cfb\u7edf\u4e2d\uff0c\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u8fd0\u884cexe\u6587\u4ef6\uff1a<\/p>\n

mono MyApp.exe<\/p>\n

\u4ee5\u4e0a\u5c31\u662f\u5c06Xamarin\u5e94\u7528\u6253\u5305\u6210exe\u6587\u4ef6\u7684\u8be6\u7ec6\u4ecb\u7ecd\u3002\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u6253\u5305\u6210exe\u6587\u4ef6\u540e\uff0c\u6587\u4ef6\u5927\u5c0fexe\u5c01\u88c5\u5de5\u5177<\/a>\u4f1a\u6bd4\u539f\u6765\u7684\u5e94\u7528\u5927\u5f88\u591a\uff0c\u56e0\u4e3aexe\u6587\u4ef6\u4e2d\u5305\u542b\u4e86Mono\u6846\u67b6\u548c\u5e94\u7528\u7684\u6240\u6709\u4f9d\u8d56\u9879\u3002\u56e0\u6b64\uff0c\u6253\u5305\u6210exe\u6587\u4ef6\u4ec5\u9002\u7528\u4e8e\u9700\u8981\u72ec\u7acb\u8fd0\u884c\u7684\u5e94\u7528\uff0c\u4e0d\u9002\u7528\u4e8e\u9700\u8981\u90e8\u7f72\u5230\u670d\u52a1\u5668\u4e0a\u7684\u5e94\u7528\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

Xamarin\u662f\u4e00\u6b3e\u8de8\u5e73\u53f0\u79fb\u52a8\u5e94\u7528\u5f00\u53d1\u6846\u67b6\uff0c\u53ef\u4ee5\u4f7f\u7528C#\u8bed\u8a00\u5f00\u53d1iOS\u548cAndroid\u5e94\u7528\u3002\u5728\u4f7f\u7528Xamarin\u5f00\u53d1\u5e94\u7528\u65f6\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528Visual Studio\u6216Xamarin Studio\u8fdb\u884c\u5f00<\/p>\n","protected":false},"author":9,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[366,24736,16,384,11091],"topic":[],"class_list":["post-24243","post","type-post","status-publish","format-standard","hentry","category-exekf","tag-366","tag-exe","tag-16","tag-384","tag-11091"],"_links":{"self":[{"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/posts\/24243","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/users\/9"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/comments?post=24243"}],"version-history":[{"count":1,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/posts\/24243\/revisions"}],"predecessor-version":[{"id":24273,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/posts\/24243\/revisions\/24273"}],"wp:attachment":[{"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/media?parent=24243"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/categories?post=24243"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/tags?post=24243"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/topic?post=24243"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}