Installing mono on Code Ocean (to run C# code)

Mono is an open source implementation of Microsoft's .NET Framework.

Shahar Zaks avatar
Written by Shahar Zaks
Updated over a week ago
  1. Switch to the postInstall script and use the following:

#!/usr/bin/env bash
set -ex

buildDeps="apt-transport-https dirmngr ca-certificates"
apt update && apt install -y $buildDeps
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo "deb https://download.mono-project.com/repo/ubuntu vs-bionic main" | tee /etc/apt/sources.list.d/mono-official-vs.list
apt update && apt-get install -y monodevelop
apt-get purge -y $builodDeps && rm -rf /var/lib/apt/lists/*

You can check that this worked by running mono --version  in your run  script, which should give output like:

Mono JIT compiler version 5.18.1.28 (tarball Tue Jul 16 22:21:52 UTC 2019)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
        TLS:           __thread
        SIGSEGV:       altstack
        Notifications: epoll
        Architecture:  amd64
        Disabled:      none
        Misc:          softdebug
        Interpreter:   yes
        LLVM:          yes(600)
        Suspend:       preemptive
        GC:            sgen (concurrent by default)
Did this answer your question?