Build C#9 with AppCenter

First I must confess something.
I think that appcenter is one of the best devops tool on the market:

But, lately, some of you may have encountered a quite upsetting issue with appcenter builds:

It cannot build C#9:

The issue lies on the mono side of appcenter, the latest stable build cannot build C#9, it uses msbuild 15:

Trying to compile C#9 code will result numerous errors.

The good news is that the Preview ( version supports C#9.

So can we uses the latest preview of mono instead of the stable one?

First you need to know that you can add custom scripts to appcenter at various build steps:

  • Post-clone (
  • Pre-build (
  • Post-build (

more here:

All you have to do is add file at the root of your project (or solution) with the correct naming convention.

Thanks to this, we can use tools to modify the environment of appcenter.
This is what Boots is doing, a great tool by the even greater Jonathan Peppers:

So as stated in the article I tried to install new version of mono in the script of my build.

Unfortunately it seems to break the nuget command in some way:

Then I saw the light, since it broke the nuget step, why not use Boots AFTER the restore step, in the script.

Unfortunately, I hit another issue:

So should I quit?
Should I betray the Lord who is my witness and is watching from above?

So I tried a simple custom way to install the mono preview in the pre-build script (

#!/usr/bin/env bash

# Download Mono

# Add execution permission
sudo chmod +x MonoFramework-MDK-

# Install Mono
sudo installer -pkg MonoFramework-MDK- -target /  

EDIT Octobre 2021

You currently need a Post-clone script to fix a NETSDK1005 error on iOS (

/Users/runner/hostedtoolcache/dotnet/sdk/5.0.100/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(241,5): error NETSDK1005: Assets file '/Users/runner/work/1/s/XXXX/XXXX/obj/project.assets.json' doesn't have a target for 'netstandard2.0'. Ensure that restore has run and that you have included 'netstandard2.0' in the TargetFrameworks for your project. [/Users/runner/work/1/s/XXXX/XXXX/XXXX.csproj]

So add also a next to your iOS csproj:

#!/usr/bin/env bash

echo "Post-clone script executing..."

# Update nuget (fix NETSDK1005)
sudo nuget update -self  

And guess what: