- 浏览: 31801 次
文章分类
最新评论
Xamarin 平台:
Compilation
我们先看一下官网的描述:
The C# source makes its way into a native app in very different ways on each platform:
iOS – C# is ahead-of-time (AOT) compiled to ARM assembly language. The .NET framework is included, with unused classes being stripped out during linking to reduce the application size. Apple does not allow runtime code generation on iOS, so some language features are not available (see Xamarin.iOS Limitations ).
Android – C# is compiled to IL and packaged with MonoVM + JIT’ing. Unused classes in the framework are stripped out during linking. The application runs side-by-side with Java/ART (Android runtime) and interacts with the native types via JNI (see Xamarin.Android Limitations ).
Windows Phone – C# is compiled to IL and executed by the built-in runtime, and does not require Xamarin tools. Designing Windows Phone applications following Xamarin’s guidance makes it simpler to re-use the code on iOS and Android.
先学习下Android的编译过程,可以对比下java语言开发的Android应用程序:
java开发的Android应用程序编译执行过程:
Java ---(JavaC)----> .class ---> JVM load class ---> main 方法执行
Xamarin平台C#应用程序编译执行过程:
C#(.cs文件) ---(C# complier)---> IL ---> MonoVM + JIT execute
C# complier:
gmcs: compiler to target the 2.0 mscorlib.
smcs: compiler to target the 2.1 mscorlib, to build Moonlight applications.
dmcs: compiler to target the 4.0 mscorlib.
Xamarin 编译打包可执行程序:
先看一下官网介绍:
The Xamarin.Android build process is based on MSBuild, which is also the project file format used by Xamarin Studio and Visual Studio. * Ordinarily users will not need to edit the MSBuild files by hand* - the IDE creates fully functional projects and updates them with any changes made, and automatically invoke build targets as needed.
Advanced users may wish to do things not supported by the IDE's GUI, so the build process is customisable by editing the project file directly. This page documents only the Xamarin.Android-specific features and customizations - many more things are possible with the normal MSBuild items, properties and targets.
Windows 使用MSBuild, OS X 使用xbuild
Windows编译打包:
1. 确保环境已安装好 Visual Studio, Mono for Android SDK等
2. 在Xamarin创建的工程目录里找到后缀为csproj 的文件 XXX.csproj
3. 找到Mono提供的MSBuild.exe
备注:以下是我寻找到的方法:打开 XXX.csproj 寻找 <Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
在文件夹里搜索 Xamarin.Android.CSharp.targets 搜索到在MSBuild同级目录里找到了 C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe
4. 打开命令行,执行命令编译打包:
"C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe" /t:SignAndroidPackage Path\To\Your\XXX.csproj
打包完成后可以看到工程的\bin\Debug 文件夹下找到签名和未签名的apk
如果需要打包Release版本可以加上字段 /p:Configuration=Release
参考链接:
Xamarin guide
https://developer.xamarin.com/guides/cross-platform/application_fundamentals/building_cross_platform_applications/part_1_-_understanding_the_xamarin_mobile_platform/
https://developer.xamarin.com/guides/android/under_the_hood/build_process/
MSBuild 命令:
https://msdn.microsoft.com/en-us/library/ms164311.aspx
- C# language – 使用C#语言构建应用程序
- Mono .NET framework – 微软的跨平台框架
- Compiler – 根据不同平台生成不同产品的编译器
- IDE tools – 集成开发环境,包含了创建,构建,部署,编译等。
Compilation
我们先看一下官网的描述:
The C# source makes its way into a native app in very different ways on each platform:
iOS – C# is ahead-of-time (AOT) compiled to ARM assembly language. The .NET framework is included, with unused classes being stripped out during linking to reduce the application size. Apple does not allow runtime code generation on iOS, so some language features are not available (see Xamarin.iOS Limitations ).
Android – C# is compiled to IL and packaged with MonoVM + JIT’ing. Unused classes in the framework are stripped out during linking. The application runs side-by-side with Java/ART (Android runtime) and interacts with the native types via JNI (see Xamarin.Android Limitations ).
Windows Phone – C# is compiled to IL and executed by the built-in runtime, and does not require Xamarin tools. Designing Windows Phone applications following Xamarin’s guidance makes it simpler to re-use the code on iOS and Android.
先学习下Android的编译过程,可以对比下java语言开发的Android应用程序:
java开发的Android应用程序编译执行过程:
Java ---(JavaC)----> .class ---> JVM load class ---> main 方法执行
Xamarin平台C#应用程序编译执行过程:
C#(.cs文件) ---(C# complier)---> IL ---> MonoVM + JIT execute
C# complier:
gmcs: compiler to target the 2.0 mscorlib.
smcs: compiler to target the 2.1 mscorlib, to build Moonlight applications.
dmcs: compiler to target the 4.0 mscorlib.
Xamarin 编译打包可执行程序:
先看一下官网介绍:
The Xamarin.Android build process is based on MSBuild, which is also the project file format used by Xamarin Studio and Visual Studio. * Ordinarily users will not need to edit the MSBuild files by hand* - the IDE creates fully functional projects and updates them with any changes made, and automatically invoke build targets as needed.
Advanced users may wish to do things not supported by the IDE's GUI, so the build process is customisable by editing the project file directly. This page documents only the Xamarin.Android-specific features and customizations - many more things are possible with the normal MSBuild items, properties and targets.
Windows 使用MSBuild, OS X 使用xbuild
Windows编译打包:
1. 确保环境已安装好 Visual Studio, Mono for Android SDK等
2. 在Xamarin创建的工程目录里找到后缀为csproj 的文件 XXX.csproj
3. 找到Mono提供的MSBuild.exe
备注:以下是我寻找到的方法:打开 XXX.csproj 寻找 <Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
在文件夹里搜索 Xamarin.Android.CSharp.targets 搜索到在MSBuild同级目录里找到了 C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe
4. 打开命令行,执行命令编译打包:
"C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe" /t:SignAndroidPackage Path\To\Your\XXX.csproj
打包完成后可以看到工程的\bin\Debug 文件夹下找到签名和未签名的apk
如果需要打包Release版本可以加上字段 /p:Configuration=Release
参考链接:
Xamarin guide
https://developer.xamarin.com/guides/cross-platform/application_fundamentals/building_cross_platform_applications/part_1_-_understanding_the_xamarin_mobile_platform/
https://developer.xamarin.com/guides/android/under_the_hood/build_process/
MSBuild 命令:
https://msdn.microsoft.com/en-us/library/ms164311.aspx
发表评论
-
android页面布局 中间的listView填充剩余部分
2016-12-05 17:29 639<?xml version="1.0" ... -
Eclipse Memory Analyzer 分析内存溢出
2016-10-19 11:37 0一 安装篇 1. eclipse 自 ... -
微信聊天左滑显示删除实现
2016-04-06 18:04 854参考http://blog.csdn.net/xiaanmin ... -
Handler Thread
2016-03-21 16:42 432介绍 首先我们来看看为什么我们要使用HandlerThread ... -
Android Handler 作用
2016-03-21 15:31 369Android handler 作用: 什 ... -
Android UI 线程和子线程通信
2016-03-18 18:24 0从主线程发送消息到子 ... -
数据库升级
2016-03-07 17:09 0转自: http://892848153.iteye.com/ ... -
Android ListView 问题汇总
2016-01-11 11:16 498Listview 问题汇总: 1. it ... -
Intent与Activity启动模式相关的Flag
2015-11-27 16:08 370网上对于 Intent 的 flag 做了很多介绍,都 ... -
android 让一个控件按钮居于底部的几种方法
2015-04-09 15:00 0android 让一个控件按钮居于底部的几种方法 1.采用li ... -
Service 理解
2015-03-11 19:08 01. Service 也是运行在主线程,和Activity级别 ... -
回调 同步 异步
2014-12-16 17:34 0回调 同步 异步 -
JSON
2014-12-16 17:33 0JSON 的使用场景 -
远程service
2014-12-16 17:32 0远程Service使用场景: 1. 远程Service-- ... -
Android 实现两个控件分别靠左侧边缘和右侧边缘,且不重叠
2014-12-11 16:02 40451. 使用relativeLayout 从右侧往左侧加,但是问 ... -
Android系统源码数据库(mmssms.db)(转)
2013-11-18 17:00 881论Android系统源码数据库(mmssms.db)中几个表之 ... -
Android SMS 数据库
2013-11-18 14:57 793$ adb shell $ cd data/data $ cd ... -
PC 操作Android手机
2013-11-15 18:10 557https://code.google.com/p/andro ... -
下载Android source 问题
2013-10-17 10:34 603fatal: '../platform/abi/cpp.git ... -
查看Android数据库
2013-03-19 15:26 5721. adb shell; 2. cd data/data 3 ...
相关推荐
不用再去打开VS庞大的工程, 可以直接编译解决方案\项目(也就是命令行编译)
Xamarin绑定助手Xamarin.Binding.Helpers是一个带有MSBuild任务和其他有用工具的NuGet程序包,可帮助简化绑定!如何使用呢? 如果您想立即使用可用的功能,本节适合您。 否则,请继续阅读以下内容,以了解其背景和上...
64位系统:替换C:\Program Files (x86)\MSBuild\Xamarin\Android\mandroid.exe 32位系统:替换C:\Program Files\MSBuild\Xamarin\Android\mandroid.exe iOS: 64位系统:替换C:\Program Files (x86)\MSBuild\Xamarin...
一个简单的msbuild命令行使用demo,可直接编译项目,无论是解决方案(sln)还是csproj或者vbproj。msbuild真的非常好,有了它就不用打开笨重的visual studio了!如需实际使用,请执行填写项目相对路径(绝对路径也可以)...
1. Copy "mandroid.exe" to "C:\Program Files (x86)\MSBuild\Xamarin\Android" (or "C:\Program Files\MSBuild\Xamarin\Android" if you are on a 32-bit operating system) 2. Copy "mtouch.exe" to "C:\Program ...
破解iOS:复制 mtouch.exe 到 %PROGRAMFILES(x86)%\MSBuild\Xamarin\iOS 在cmd命令里切换到%PROGRAMFILES(x86)%\MSBuild\Xamarin\iOS目录下运行以下命令进行注册: mtouch.exe --activate --activation-name=b4a...
Windows 8 SDK 离线安装包,用于解决MsBuild自动编译找不到 aximp.exe 或 Lc.exe 的问题!
1. Copy "mandroid.exe" to "C:\Program Files (x86)\MSBuild\Xamarin\Android" (or "C:\Program Files\MSBuild\Xamarin\Android" if you are on a 32-bit operating system) 2. Copy "mtouch.exe" to "C:\Program ...
使用说明: ...1. 复制 "mandroid.exe" 到 "C:\Program Files (x86)\MSBuild\Xamarin\Android" (32位系统到 "C:\Program Files\MSBuild\Xamarin\Android" ) 2. 运行keygen.exe生成 序列号. PS.需要.NET4.0
破解Android:复制mandroid.exe 到 %PROGRAMFILES(x86)%\MSBuild\Xamarin\Android 在cmd命令里切换到%PROGRAMFILES(x86)%\MSBuild\Xamarin\Android目录下运行以下命令进行注册: mandroid.exe --activate --...
1. Copy "mandroid.exe" to "C:\Program Files (x86)\MSBuild\Xamarin\Android\" (or "C:\Program Files\MSBuild\Xamarin\Android\" if you are on a 32-bit operating system) 2. Run keygen.exe to generate the ...
msbuildtasks, MSBuild社区任务项目是MSBuild任务的开放源代码项目 MSBuild社区任务 MSBuild社区任务项目是MSBuild任务的开放源代码项目。 下载最新版本可以从 releases section下载。 ...
MSBuild社区任务项目是用于MSBuild任务的开源项目。 维护者通缉 为该项目寻找新的维护者。 如果您有兴趣成为该项目的维护者,请告诉@ pwelter34。 下载 可以从发行版部分下载最新版本。 也可以在nuget.org上通过...
涵盖了MSBuild的命令行参数,是编写MSBuild自动执行脚本的参考。
MSBuild 引入了一种新的基于 XML 的项目文件格式,这种格式容易理解、易于扩展并且完全受 Microsoft 支持。MSBuild 项目文件的格式使开发人员能够充分描述哪些项需要生成,以及如何利用不同的平台和配置生成这些项...
即将推出的功能支持MsDeploy / WebDeploy发行说明2017年4月1日更新:最新的vsts-task-lib和打字稿版本2016年6月17日初版描述此扩展包含单个任务,可帮助您为常见操作设置MsBuild命令行参数。 配置所需的任务,然后将...
MSBuild vc编绎时使用的构件。
这是从MSBUILD开始的一些好地方,MSBUILD是.NET中内置的基于XML的新生成文件系统。 MSBUILD MBUILD MSDN基本介绍
支持不编译程序集的实用程序项目。 Microsoft.Build.Artifacts 支持来自构建输出的暂存工件。 如何使用这些SDK? 当使用通过NuGet获得的MSBuild Project SDK(例如此仓库中的SDK)时,必须指定特定版本。 将...
Gradle MsBuild插件 这个插件可以编译一个MsBuild项目。 它还支持项目文件解析,以及一些基本的最新检查以跳过构建。 我怀疑它现在是否可以在.csproj文件以外的任何其他文件上使用,但是添加对更多文件的支持将很...