2

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.

Brandon
  • 869
  • 1
  • 8
  • 16

1 Answers1

0

First, I would start here:

How to make a smaller Mono install / Small Footprint

For myself:

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:

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...

FYI:

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}

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}

Updates for the comment:

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?

Running without the GAC:

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...

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/#monopath

And:

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

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.

SushiHangover
  • 73,120
  • 10
  • 106
  • 165
  • Thanks so much for the info. That's helpfull. 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? – Brandon Sep 10 '15 at 23:36
  • Thanks - this answers everything! – Brandon Sep 11 '15 at 16:37