Specifying the mono version to build against on the command line

We are trying to set up a more advanced build configuration for Xamarin Studio, and we are wondering whether there is a way to specify the Mono version we want to use for a build (as in $ mdtool ...).

The option is available in the Xamarin Studio IDE (Project > Active Runtime), but we can't seem to find a way to do this on the command line.


  • JeffreyStedfastJeffreyStedfast USXamarin Team Xamurai
    edited August 2013

    There may be a better way (perhaps @mhutch can chime in), but one way you could do it is to set the environment variables for your mono location:

    export ACLOCAL_PATH="$MONO_PREFIX/share/aclocal:$ACLOCAL_PATH"
    export ACLOCAL_FLAGS="-I $MONO_PATH/share/aclocal $ACLOCAL_FLAGS"
    export PKG_CONFIG_PATH="$MONO_PREFIX/lib/pkgconfig:$MONO_PREFIX/share/pkgconfig:$PKG_CONFIG_PATH"
    export PATH="$MONO_PREFIX/bin:$PATH"

    replace $MONO_PREFIX with the path to your mono installation (if you are on Mac, this should be something like /Library/Frameworks/Mono.framework/Versions/$VERSION)

    The following url has more details (the above snippet was taken from my own personal shell script):


    Note: In all likelihood, the ACLOCAL_* environment variables aren't needed.

  • RobinRobin USUniversity ✭✭

    Thanks Jeffrey, that seems to work for the runtime. However, we cannot seem to understand how the Xamarin.Android and Xamarin.iOS versions are or can be selected in this scenario (or is this handled automatically?). Looking at directory "/Library/Frameworks/Xamarin.Android.framework/Versions", I see all currently installed Xamarin.Android versions as well as a symlink 'Current'. However, there is no such thing as a "/Library/Frameworks/Xamarin.iOS.framework" folder so these are definitely handled in different ways.
    For the Android builds, we were thinking of changing the 'Current' symlink to the required version before the build and restoring it afterwards.
    For the iOS builds, we have no clue what to do.

    As a side issue, when we do an upgrade of our environment (e.g. from stable 3.2.0 to beta 3.2.1) the /Library/Frameworks/Mono.framework/Versions/3.2.0 folder disappears. I don't know if this is expected behaviour, but it's not desired in the case where we would like to do command line builds against previous versions. (the downgrade, from 3.2.1 to 3.2.0 doesn't seem to remove the directory for 3.2.1 though).

  • JeffreyStedfastJeffreyStedfast USXamarin Team Xamurai
    edited August 2013

    I don't think the iOS build uses environment variables, it uses the Xamarin Studio preferences file in ~/Library/Preferences/XamarinStudio-4.0/MonoDevelopProperties.xml

    We want to move the iOS build engine to use MSBuild targets, but so far it is all in the old MonoDevelop 1.0 build engine.

    The Android build logic is in the MSBuild engine, though, and so might be able to use environment variables, I just don't know what they are.

    One trick you could use for Android is probably to change the "Current" symlink to point to the Version you want to use. It's a slight hack, but it's simple.

    Perhaps when @mhutch gets back from his trip, he'll be able to provide a better answer.

Sign In or Register to comment.