Install specific Mono version

xamarin
#1

Hi,
This is related to the issue I raised here:

TLDR version of this: NUnit fails to run tests that use Moq or Castle Proxies - its a known bug in Mono.

Also related to the Slack discussion with @viktorbenei in #general.

To fix my issue the Mono version needs to be upgraded. I’ve done some testing and it appears the Mono version currently being used by the Xamarin beta stack fixes the issue.

Mono 5.4.0.0201 has the issue. This is the version that Vs4Mac from the stable channel installs.
It appears to be fixed in 5.4.0.212.

Is it possible to create a step/script to install a specific version of Mono?

Cheers

1 Like

#2

I’ll try to make some time today to write an example Script, but can’t promise it for 100%

AFAIK installing Mono should be fairly straight forward, downloading the running its installer, but I might be wrong; hopefully I’ll have some time for it today to check.

0 Likes

#3

Had some time testing and indeed it seems simply downloading a pkg from mono’s website (http://www.mono-project.com) or more specifically from their downloads site (https://download.mono-project.com/archive/) and installing it with the macOS built in pkg installer (installer) works like a charm, I did not have to change anything else.

Script to install the previous Visual Studio for Mac Stable’s Mono version (5.2.0.224) - can be the very first step in the workflow:

#!/bin/bash
set -ex

# create a temp dir and cd into it
mkdir -p /tmp/mono-install
cd /tmp/mono-install

# debug: mono version before the install
mono --version

# download mono mac installer (pkg)
wget -q https://download.mono-project.com/archive/5.2.0/macos-10-universal/MonoFramework-MDK-5.2.0.224.macos10.xamarin.universal.pkg -O ./mono-installer.pkg

# install it
sudo installer -pkg ./mono-installer.pkg -target /

# debug: mono version after install, just to confirm it did overwrite the original version
mono --version

# just for fun print this symlink too, which should point to the version we just installed
ls -alh /Library/Frameworks/Mono.framework/Versions/Current
1 Like

Weekly Virtual Machine / Stack updates - 2017.10.14
Weekly Virtual Machine / Stack updates - 2017.10.21
#4

@benrnz-sv can you test the script with your project? It worked on my simple test Xamarin project, but you can never know.

P.S.: just drop in the Script step as the very first step in the Workflow; it can be before the Git Clone step etc as it does not have any dependency.

0 Likes

#5

Thanks @viktorbenei, that works great!
That’ll definitely be a useful piece of kit to save, if (when) there are future problems with Xamarin and Mono.
Cheers

1 Like

#6

Thanks for confirming @benrnz-sv, it definitely will be useful - I’ll create a #how-to :wink:

0 Likes