11

I am trying to setup a development machine using 20.04 and am having problems with the Monodevelop environment.

Whenever I create a solution and project it seems that it cannot find the proper build setup. I suspect there is some problem when using the 18.04 mono repositories on 20.04, but I can't find out how to fix it.

This is the error I receive when I try to build using the Monodevelop IDE:

/usr/lib/mono/msbuild/15.0/bin/Microsoft.CSharp.CurrentVersion.targets(5,5): 
Error MSB4019: The imported project "/usr/lib/mono/msbuild/15.0/bin/Roslyn/Microsoft.CSharp.Core.targets" was not found.
Confirm that the path in the <Import> declaration is correct, and that the file exists on disk. (MSB4019) (HelloWorld)

Does anyone know how to get a working version of Monodevelop on Ubuntu 20.04?

Kevin Bowen
  • 19,395
  • 55
  • 76
  • 81
sysrpl
  • 241
  • 1
  • 2
  • 5
  • For close voters - 20.04 LTS is released. About MonoDevelop see https://askubuntu.com/a/1228572/66509 . – N0rbert Apr 24 '20 at 09:10
  • I'm not using MonoDevelop, but compile projects that have been created in Visual Studio. Since Mono version 5.n I've been using msbuild to compile my projects, but this no longer works in Ubuntu 20.04. In my case, msbuild cannot be found. Trying to install msbuild doesn't fix the issue. – Peter Gloor Apr 25 '20 at 14:07

4 Answers4

8

I managed to fix this on Ubuntu 20.04.

First, add mono-project's repo for 18.04 by following the official instructions, pasted here for convenience:

sudo apt install gnupg ca-certificates
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo "deb https://download.mono-project.com/repo/ubuntu stable-bionic main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list
sudo apt update

Then install mono-roslyn using:

sudo apt install mono-roslyn

Rebuild your project.

vydd
  • 81
  • 2
  • 1
    It's worth mentioning this explicitly: As of now, the Ubuntu 20.04 repo version of `mono-complete` 6.8 doesn't include `msbuild`, `mono-roslyn`, etc (maybe because of license?) so adding the mono repo to apt really is necessary if you want to use msbuild instead of the deprecated `xbuild`. – geekley Oct 23 '20 at 02:09
  • This also worked for me on Ubuntu 20.10 (which also still has mono 6.8 by default) – Andreas Fester Feb 01 '21 at 20:29
1

Mono is not yet available in stable repo, but you can install it with the preview-focal main with the following.

sudo apt install gnupg ca-certificates
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo "deb https://download.mono-project.com/repo/ubuntu preview-focal main" | sudo tee /etc/apt/sources.list.d/mono-official-preview.list
sudo apt update

# if the packages were already installed
sudo apt upgrade

# otherwise
sudo apt install mono-complete msbuild

Later you can test it with a simple hello world application by creating a file called hello.cs

using System;

public class HelloWorld
{
    public static void Main(string[] args)
    {
        Console.WriteLine ("Hello Mono World");
    }
}

Compile it with csc hello.cs. It will generate an exe. Now run it with mono hello.exe and it should work

diegosasw
  • 201
  • 3
  • 6
0

I try but get Debugger operation failed

ApplicationName='/usr/lib/gnome-terminal/gnome-terminal-  
server', CommandLine='--app-id  
mono.develop.id9462e6d67d3f4540ace204fe87960524',  
CurrentDirectory='', Native error= Cannot find the specified file

enter image description here

Kulfy
  • 17,416
  • 26
  • 64
  • 103
0

I've had luck with setting up monodevelop 7.8.4 (build 2) Mono version 6.12.0.122 on Ubuntu 21.10 using Debian Buster source.

  1. First you will need to install libjpeg62-turbo_1.5.2-2+deb10u1_amd64.deb.

  2. Once you have this installed, open a terminal and type:

    sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
    echo "deb https://download.mono-project.com/repo/debian buster main" | sudo tee /etc/apt/sources.list.d/mono-official-vs.list
    sudo apt update
    sudo apt install monodevelop
    
  3. At this point monodevelop loads and runs, but will not debug and you will see an error that looks like this:

    ApplicationName='/usr/lib/gnome-terminal/gnome-terminal-server', CommandLine='--app-id mono.develop.id9462e6d67d3f4540ace204fe87960524', CurrentDirectory='', Native error= Cannot find the specified file
    
  4. To fix this, we go back to the terminal and run:

    cd /usr/lib
    sudo mkdir gnome-terminal
    cd gnome-terminal
    sudo ln -s /usr/libexec/gnome-terminal-server
    
  5. Reboot and enjoy.

BeastOfCaerbannog
  • 12,964
  • 10
  • 49
  • 77