I am forced to learn and practice C#, is there any applications that support and can be used to write programs in C#?
-
10What have you tried? Using a simple Google combination of keywords `C# Ubuntu` reveals the answer already. – gertvdijk Dec 28 '12 at 14:12
-
fine i will vote to delete this question – AmirRazoR Dec 28 '12 at 14:21
-
3Just from experience here - it is likely that your college course is going to assume you are on windows, and will likely use several windows only features in C# that don't always correlate to mono very well, such as winforms (although I think mono may have since implemented winforms, but I'm not sure). You may run into issues. – Drake Clarris Dec 28 '12 at 15:17
-
well, since the day i started using ubuntu i didn't go to windows a single time. but i will keep this advice on my mind. – AmirRazoR Dec 28 '12 at 15:49
-
3@AmirRazoR The mono runtime does support Windows Forms. However, I am not aware of any integrated development environments in Ubuntu that support creating them visually. If your class is on the C# language, I'd guess it won't cover Windows Forms, but it might. If you do find you must use a Windows operating system, you might consider running Windows in a virtual machine on an Ubuntu system. Virtualizing Windows does require that you have a copy, though. (Or, if you need better graphics acceleration than a virtual machine would provide, you could run Ubuntu in a virtual machine on Windows.) – Eliah Kagan Dec 28 '12 at 16:39
-
It may be possible to use VS in WINE as well, but not completely sure – Drake Clarris Dec 28 '12 at 18:49
-
I also had the same question. I googled and it directed me here. Some like gertvdijk and AmirRazoR wanted to delete this question, but they may be experts, but we are just beginners. They may know the answer, but we do not know. Thanks to this question, I found the solution. Let this question serve the beginners like us. – Buddhika Ariyaratne Jul 29 '18 at 14:23
4 Answers
Yes you can use mono
For a nice IDE to work in try monodevelop:
sudo apt-get install monodevelop
This will also pull in all the necessary runtimes needed.
- 7,279
- 9
- 31
- 52
- 10,387
- 2
- 32
- 29
What you are looking for is Mono, which is, quoting from the project's website:
An open source, cross-platform, implementation of C# and the CLR that is binary compatible with Microsoft.NET
Mono also comes with an Integrated Development Environment (IDE): MonoDevelop. Both softwares are packaged for Ubuntu.
Mono
MonoDevelop
This last package depends on the first one. Installing this package will automatically install the other.
- 15,616
- 2
- 64
- 81
-
i am installing Monodevelop right now, would this also install Mono, or i should run a specific command to install it? – AmirRazoR Dec 28 '12 at 14:27
-
@AmirRazoR: yes, it would install Mono. I've also updated my answer to add this information. – Andrea Corbellini Dec 28 '12 at 14:31
You can develop C# applications on linux with .NET Core: https://www.microsoft.com/net/core
After you install it, type dotnet new in your terminal to get a list of application templates which can be generated for you to start.
As of .NET Core 2.0 today, this is the list:
Templates Short Name Language Tags
--------------------------------------------------------------------------------------------------------
Console Application console [C#], F#, VB Common/Console
Class library classlib [C#], F#, VB Common/Library
Unit Test Project mstest [C#], F#, VB Test/MSTest
xUnit Test Project xunit [C#], F#, VB Test/xUnit
ASP.NET Core Empty web [C#], F# Web/Empty
ASP.NET Core Web App (Model-View-Controller) mvc [C#], F# Web/MVC
ASP.NET Core Web App razor [C#] Web/MVC/Razor Pages
ASP.NET Core with Angular angular [C#] Web/MVC/SPA
ASP.NET Core with React.js react [C#] Web/MVC/SPA
ASP.NET Core with React.js and Redux reactredux [C#] Web/MVC/SPA
ASP.NET Core Web API webapi [C#], F# Web/WebAPI
global.json file globaljson Config
Nuget Config nugetconfig Config
Web Config webconfig Config
Solution File sln Solution
Razor Page page Web/ASP.NET
MVC ViewImports viewimports Web/ASP.NET
MVC ViewStart viewstart Web/ASP.NET
The current latest version is 2.0 and covers all my needs.
- 423
- 5
- 10
-
I like that this answer seems to be IDE independent but I'm curious as to what kind of programs would be comfortable working with the projects generated by these commands? I didn't see support for Razor pages in MonoDevelop for instance. And VSCode still seems clunky to me with its very strict modular approach to plugins and compilers. – fIwJlxSzApHEZIl Aug 17 '18 at 17:51
-
Rider seems promising: https://www.jetbrains.com/rider/ but I haven't tried it yet. In the mean time I moved back to Windows, because I was missing too many features on Linux. I'm a C# developer. And Visual Studio just makes the development so much easier. I was using Sublime Text for some time on Linux. – tedi Aug 20 '18 at 12:28
You could use Visual Studio Code using apt:
wget -q https://packages.microsoft.com/keys/microsoft.asc -O- | sudo apt-key add -
echo "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main" | sudo tee /etc/apt/sources.list.d/vscode.list
sudo apt update
sudo apt install code
or snap:
sudo snap install code --classic
After the C# package installing, the next dialog box appears:
Clicking the marked button opens the next page, which provides the instructions for .Net Core SDK installation (along with ASP.Net Core runtime and .Net Core runtime installation instructions):
wget https://packages.microsoft.com/config/ubuntu/19.10/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo apt install ./packages-microsoft-prod.deb
sudo apt-get update
sudo apt-get install apt-transport-https
sudo apt-get update
sudo apt-get install dotnet-sdk-3.1
monodevelop IDE seems is not an option now, because of I could not find it. But if you want to install the current mono version (For example, on 20.04, amd64 architecture) you could use official mono repository:
sudo apt install gnupg ca-certificates
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo "deb [arch=amd64] https://download.mono-project.com/repo/ubuntu stable-focal main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list
sudo apt update
sudo apt install mono-devel
You could also install additional mono packages, which you could find by:
apt-cache search mono
The man mono will introduce you to its usage:
DESCRIPTION
mono is a runtime implementation of the ECMA Common Lan‐
guage Infrastructure. This can be used to run ECMA and
.NET applications.
- 7,279
- 9
- 31
- 52


