Search code examples
xamarinazure-devopsazure-pipelinesrelease-management

Install new versions of dependencies on Azure devops microsoft hosted build server


I have an issue with my azure build pipeline for a Xamarin mobile app in iOS. The issue required mono version 6.10.0 to be available on the build server. Currently the pre-installed image for macOS 10.14 only contains Mono up to version 6.08. The image for macOS 10.15 does contain the right version of Mono but due to internal reasons I am unable to upgrade to 10.15 at this point.

Is there a way to update the pipeline to install the new version of Mono before building? Or are we completely limited to the software that is included in the image? I am using a microsoft hosted server.


Solution

  • Is there a way to update the pipeline to install the new version of Mono before building?

    As you said, the Mono version 6.10.0 doesn't exist in the Microsoft-Hosted Agent: Macos-10.14, but you could run the script before the Xamarin task to install the target Mono version.

    Here is the pipeline example:

    steps:
    - bash: |
       #!/bin/bash
       set -ex
       
       
       MONO_MACOS_PKG_DOWNLOAD_URL='https://download.mono-project.com/archive/6.10.0/macos-10-universal/MonoFramework-MDK-6.10.0.49.macos10.xamarin.universal.pkg'
       
       
       mkdir -p /tmp/mono-install
       cd /tmp/mono-install
       
       # debug: mono version before the install
       mono --version
       
       # download mono mac installer (pkg)
       wget -q -O ./mono-installer.pkg "$MONO_MACOS_PKG_DOWNLOAD_URL"
       
       # 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
      displayName: 'Bash Script'
    
    - script: |
       mono -V
       
       cat `which mcs`
      displayName: 'Command Line Script'
    

    Here is a Blog about install the mono.

    Result:

    enter image description here