减少Mono运行时大小 [英] Reduce Mono runtime size

查看:140
本文介绍了减少Mono运行时大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经从Amazon Linux实例上的源代码编译了mono运行时.编译后,"lib"和"bin"目录总计为320MB.我想让它尽可能的小.我可以从那里删除什么(如果有的话)以节省尽可能多的空间.

I have compiled the mono run-time from source on an Amazon Linux instance. After compiling, the 'lib' and 'bin' directories total 320MB. I would like to get this as small as possible. What (if anything) can I delete from there to save as much space as possible.

推荐答案

首先,我将从这里开始:

First, I would start here:

如何制作更小的Mono安装/小尺寸

对于我自己:

我不会剥离二进制文件或重新链接"程序集,但是我确实配置了许多选项,但在单声道4.x版本中,您的行驶里程可能会有所不同:

I do not strip the binaries or 're-link' the assemblies, but I do configure with a bunch of options turned off, of course, with the 4.x version of mono your mileage may vary:

我的Mono目录的OS-X/Linux磁盘使用量约为174MB,其中GAC(~~/lib/mono/GAC)中的磁盘使用量约为60MB.如果您没有使用GAC来解析程序集(我没有这样做),那么对于完整的4.5框架,我剩下大约110MB的空间.我个人从未使用过该框架中的许多项目,但我从未发现值得为此创建一个删除列表来尝试另外保存10-30MB ...

My OS-X/Linux disk usage for the mono dir weighs in at about 174MB with about 60MB of that within the GAC (~~/lib/mono/GAC). If you are not using the GAC to resolve assemblies, which I do not, I am left with about 110MB for the full 4.5 framework. There are lots of items in the framework that I personally never use but I never found it worthwhile to create a delete list for it to try to save another 10-30MB...

仅供参考:

我的小型" OS-X配置:

My 'small' OS-X configure:

./autogen.sh \
     --with-tls=posix \
     --enable-nls=no \
     --with-mcs-docs=no \
     --with-profile2=no \
     --with-profile4=no \
     --with-profile4_5=yes \
     --with-moonlight=no \
     --host=i386-apple-darwin10 \
     --with-glib=embedded \
     --prefix=${PlayInstallPath}

我的小型" Linux配置:

My 'small' Linux configure:

./autogen.sh \
     --with-mcs-docs=no \
     --with-profile2=no \
     --with-profile4=no \
     --with-profile4_5=yes \
     --with-moonlight=no \
     --prefix=${PlayInstallPath}

评论更新:

我可以摆脱2.0目录-我将始终以4.5为目标 框架.我该如何只使用4.5目录并摆脱 GAC的?我可以在那里复制正确的dll吗?

Can I get rid of the 2.0 directory - I will always be targeting 4.5 framework. How do I go about using only the 4.5 directory and get rid of the GAC? Can I just copy the proper dlls there?

在没有GAC的情况下运行:

Running without the GAC:

如果您查看Xamarin Studio/Mono Develop之类的应用程序,它将使用MSBuild来解析程序集的位置,而不是GAC.确实并不需要GAC,在新的MS .Net Core部署模型中,仅将app/service/Docker/etc所需的所有.Net程序集复制到相同的部署目录中,版本问题不再是您要考虑的问题.回滚目录更改以恢复到先前的版本,或者只是符号链接到其他目录以更改为新版本,等等...如果要在生产阶段/版本中执行此操作,请与您的DevOps协调以协调谁/做什么/何时/何地...

If you look at an app like Xamarin Studio/Mono Develop, it uses MSBuild to resolve the assembly locations and not the GAC. The GAC is not really needed and in the new MS .Net Core model of deployment all the .Net assemblies needed for an app/service/Docker/etc are just copied to the same deployment directory, versioning issues are not an issue as you can roll back directory changes to revert to a prior build or just sym-link to a different directory to change to a new version, etc... if you are doing this for production staging/version, talk to your DevOps to coordinate who/what/when/where...

在Mono中,您可以使用MONO_PATH跳过GAC并直接转到lib目录,虽然的最佳做法是,它在 our 环境下有效我们正在做什么(您的里程会因应用程序类型而异),但是请阅读以下Mono链接以了解优缺点以及操作方法:

In Mono, you can use MONO_PATH to skip the GAC and go directly to the lib directory, while this is NOT a best practice, it works in our environment for what we are doing (your milage will vary depending upon app type), but read the following Mono links to understand the pro and cons and how you should be doing it:

http://www.mono-project.com/archived/best_practices/#单路径

并且:

http://www.mono-project.com/docs /getting-started/application-deployment/

对于net_2_0目录,在autogen/configure步骤中通过"--with-profile2 = no"关闭该配置文件时,我再也找不到目录.

As far as the net_2_0 directory, I never get one as I turn off that profile via "--with-profile2=no" in the autogen/configure step.

这篇关于减少Mono运行时大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆