Running C# in Sublime is quite a handy trick to pull out when you don’t feel like creating a whole project. Apart from the fact that sublime is a great text editor.
You are going to need to download and install the following.
Chocolatey - Chocolatey is a package manager for Windows (like apt-get or yum but for Windows).
To install Chocolatey you will need to run the following commands in powershell. There are alternative installation instructions provided on the Chocolatey website.
Ensure you are running Chocolatey as Administrator.
Execute the following command to set the execution policy to RemoteSigned.
Execute the following to download and install via powershell.
iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1')) iwr https://chocolatey.org/install.ps1 -UseBasicParsing | iex
Once installed run the following to install ScriptCS.
choco install scriptcs
Back in sublime you need to open your package manager. “Ctrl + Shift + P”. Once open type “Install Package”.
You will be taken to all available packages you wish to install. Find scriptcs and continue.
Under Tools navigate to Build System and set it to ScriptCs.
Open up an new file and set the syntax to C#. Save the new cs file wherever you wish. At this point you can now begin writing C# code. To execute the code in your console hit “Ctrl + B”.
And thats it! Running C# in sublime.