July 4, 2020

[Note] Mono on Ubuntu 20 for C#, F#


Install Mono

sudo apt update
sudo apt install mono-complete
sudo apt install monodevelop-nunit


Install F# if not installed -- check first if it's already installed then:
sudo apt-get install fsharp


Install dot-core


Install SDK
wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
sudo apt-get update
sudo apt-get install -y apt-transport-https && sudo apt-get update && sudo apt-get install -y dotnet-sdk-3.1

 
Option 1: ASP.NET Core Runtime
sudo apt-get update
sudo apt-get install -y apt-transport-https && sudo apt-get update && sudo apt-get install -y aspnetcore-runtime-3.1

Option 2: .NET Core Runtime -- I installed .NET Core, not ASP
sudo apt-get install -y dotnet-runtime-3.1

Install Mono-Develop IDE

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

To use with MonoDevelop, it is necessary to install additional packages:
$ sudo apt-get install mono-roslyn
$ sudo apt-get install dotnet-sdk-2.1

Otherwise you won't be able to compile & run within MonoDevelop.  Some folks say Visual Studio Code is a better tool.  You can try that.


Check

$ mono --version
$ which mono-csc   # not "csc"


Closing

MonoDevelop IDE is great.  Installing Mono/C#/F# and setting up on Ubuntu is cumbersome.  Hope someone come up with simple meta package installing all of the above in one shot.  I'm going to try VS community edition on Win10 VM.  

Ubutnu 20
Surprisingly, after I switched to Ubuntu 20, things are much smoother and faster than Win10.  Ubuntu needs to iron out some small details to be equal to Win10 in terms of UI; regardless, I think it's ready for desktop OS/UI for everyone.  Also, Win10 VM on Ubuntu is faster/smoother than Win10 VM on Win10 using VirutalBox.  With Docker, it's the best environment if you don't have to use Windows specific software/features/development.  I got tired of Windows forcing to install updates/patches and only to find it has a lot of issues.  I also have used Mac and still using it occasionally -- they are claiming the best developer environment, but I think Ubuntu 20+Docker is the best environment to work on and use.


Reference

  1. https://websiteforstudents.com/how-to-install-mono-on-ubuntu-20-04-18-04/
  2. https://linuxize.com/post/how-to-install-mono-on-ubuntu-20-04/
  3. https://www.monodevelop.com/download/
  4. https://www.mono-project.com/download/stable/
  5. https://docs.microsoft.com/en-us/dotnet/core/install/linux-ubuntu#2004-
  6. https://atlemann.github.io/fsharp/2018/01/13/fsharp-on-ubuntu-16-04.html
  7. https://fsharp.org/use/linux/
  8. https://www.digitalocean.com/community/tutorials/how-to-install-f-and-set-up-a-local-programming-environment-on-ubuntu-18-04
  9. https://github.com/mono/mono/issues/19648
  10. https://stackoverflow.com/questions/40159145/monodevelop-cannot-execute-project
  11. https://code.visualstudio.com/docs/languages/dotnet

No comments: