I
I
Ilya Sidorenko2014-02-16 07:36:30
C++ / C#
Ilya Sidorenko, 2014-02-16 07:36:30

How to compile and run C# code in Sublime Text?

What other alternatives besides MS Visual Studio?

Answer the question

In order to leave comments, you need to log in

7 answer(s)
S
Sergei Borisov, 2014-02-16
@iskros

The IDE for C# besides VisualStudio is, of course, MonoDevelop.
Don't believe @OnYourLips . You can work without a debugger. Although, with a debugger, as a rule, it is faster and more convenient. I mean debug printing in code.
The debugger does not need to be integrated into your IDE. For example, Mono Debugger (MDB) can work with .NET code, and, to a limited extent, GDB. They are both command lines. Although, again, it is more convenient to work with the debugger from the IDE. And you can work with these debuggers through the IDE. For example, MonoDevelop works with them.

A
Alexandr_Asap, 2020-08-04
@Alexandr_Asap

Hello, I wrote a simple program that immediately compiles a .cs file into an .exe and runs it.
Download the file https://yadi.sk/d/_toKxygIvDwjGw , go to Sublime\Tools\Build System\New Build System...
and write the following code

{
    "cmd": "Полный путь к файлу который вы скачали БЕЗ ПРОБЕЛОВ\\sublime_comp.exe ${file_path} ${file_base_name}"
}

And press ctrl + s, also, if you wish, you can write his name in place untitled and press save.
Then open the C# file in Sublime Text, press ctrl + shift + b and choose the name of your choice.
Now when you press ctrl + b your .cs file will compile and immediately run in Sublime Text's built-in console.

A
Artem Voronov, 2014-02-16
@newross

Author, why? Just wondering what makes people give up the official powerful tool.

D
Danny Belchenko, 2014-02-16
@belchenko

Console compiler "csc" -> More details .

D
Dialog, 2014-02-16
@Dialog

The most popular alternative is Mono.
About running and compiling code from the sublime, dig towards cli and a separate compiler file, but you will not have a debugger and other goodies. It's the same as compiling asm with the tasm.exe utility.

D
Drovosek01, 2018-02-06
@Drovosek01

Here is a detailed guide on this topic:
https://www.youtube.com/watch?v=05a7wmPN9ag
https://www.youtube.com/watch?v=_Hhg-nE24Tc

V
Valentin Petrov, 2020-09-20
@ValentinPetrov

I made a new way, maybe it will be the best alternative to the Python program:
Open Sublime Text / Tools / Build System / New Build System ..., now replace the standard code with this

{
  "shell_cmd": "csc ${file_name} && echo. &&  ${file_base_name}.exe"
}

Now press ctrl + s and write the name (optional).
Congratulations! Now you can press ctrl + shift + b and select the name you chose earlier, from now on when you press ctrl + b your code will compile and run in the built-in console.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question