70

I have a simple .net command line tool written and compiled under Windows, using .net 3.5SP1. I would like to run it on Linux using Mono.

I am using Ubuntu 12.04, and installed Mono Runtime using the Ubuntu software center. If I try to start my app in the terminal by doing:

mono MyApp.exe

I get the error:

The assembly mscorlib.dll was not found or could not be loaded. It should have been installed in the 'usr/lib/mono/2.0/mscorlib.dll'.

If I navigate to that location, I see that it does not exist. However, there is usr/lib/mono/4.0/mscorlib.dll (and some more DLLs in the same folder).

So seemingly there is a version mismatch.

[in case it matters, mono -V shows Mono JIT compiler version 2.10.8.1 (Debia 2.10.8.1-1ubuntu2) ]

Melebius
  • 6,183
  • 4
  • 39
  • 52
Warpin
  • 6,971
  • 12
  • 51
  • 77

5 Answers5

94

I got it to work by installing mono-complete:

sudo apt-get install mono-complete

After that, I had folders 2.0, 3.5, 4.0 and more under usr/lib/mono

mpen
  • 272,448
  • 266
  • 850
  • 1,236
Warpin
  • 6,971
  • 12
  • 51
  • 77
  • 1
    Did you try to use app.config to set supportedRuntime to .NET 4 on Windows first? Then you should be able to use Mono to run it as .NET 4, as mono executable should pick it up as .NET 4 app. – Lex Li May 12 '12 at 12:21
  • I got the same issue with NOOB v1.2. After I started again with Raspbian "Wheezy" os, as Lex pointed out, having in app.config made my app to use correct version (4.0) and I didn't have to install mono-complete. – bob Aug 14 '13 at 05:29
  • 1
    For those experiencing this issue with the 3.4 release, see http://stackoverflow.com/questions/22285830/linux-mono-installation-and-errors/23904603 – natli May 28 '14 at 06:51
28

If you just want to run it, sudo apt-get install libmono2.0-cil libmono-system-net2.0-cil mono-runtime may suffice.

NIA
  • 2,523
  • 22
  • 32
gfxmonk
  • 8,614
  • 5
  • 42
  • 53
  • 3
    This answer is more accurate than "install full mono". Full mono need ~170Mb while NET 2.0 libs are about ~45Mb. – m3nda Aug 27 '15 at 12:25
  • Unfortunately, this did not work for me (http://pastebin.com/XduV6vPd). Installing mono-complete took a fair bit more time, but it resolved the issue. – Tagc Mar 15 '17 at 14:11
  • @Tagc For me the message disappeared after I additionally did `sudo apt-get install libmono-system-net2.0-cil` – NIA Dec 15 '17 at 12:11
4

i got the same problem, for my distro (ubuntu 12. 32 Bit ), mono-complete has not been available. so i just installed the following packages, and mono with the most important dlls has been available:

sudo apt-get install mono-dmcs
sudo apt-get install mono-gmcs
sudo apt-get install mono-devel
Thomas Haller
  • 199
  • 1
  • 11
1

the package you're looking for was "libmono-system.data2.0-cil" which is installed with Mono-complete

Komak57
  • 113
  • 1
  • 3
  • 12
1

I ran sudo apt-get purge mono-* and then sudo apt-get install mono-complete. This created the files in /usr/lib/mono, however the error was still generated where it was looking for the file in /usr/local/lib/mono which didn't exist.

Tried to change MONO_PATH to the correct location, but didn't work. Finally ended up copying the whole directory to /usr/local/lib which finally got it to work.

hpd
  • 475
  • 1
  • 4
  • 16