Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run C# Console Application on Visual Studio Code Editor on Windows

Is there any way to create (from scratch) and run simple C# Console app in VSCode editor. ? Can you please provide step-by-step instruction how I can do that? What kind of files I must to include (except HelloWolrd.cs obviously)? What kind of commands I must to execute?

like image 233
Ivan Kononenko Avatar asked Aug 14 '15 08:08

Ivan Kononenko


People also ask

Can I run C in Terminal?

Method 1: How to run C programs in Linux terminal In order to run a C program in Linux, you need to have a C compiler present on your systems. The most popular compiler is gcc (GNU Compiler Collection). Keep in mind that it is optional to provide the output object file (-o my_program).

Can Windows run C?

You will need two things to create C programs: a text editor to write the source code for the program and a compiler to convert the source code to an executable file so the program can be run (on Windows, executable files have a ".exe" extension).

Can I run C on notepad?

Write and save the programTo write the source code of your first C program you need to open the Notepad++ text editor. The quickest way to do that in Windows 10 is to hit your Win key, type Notepad++ in the search window, and hit Enter. and paste it into the editor. Yes, this is your first C program!


2 Answers

Navigate to the folder you want to create the console app in. In VSCode, use Ctrl+` to open the terminal window or go to View and select Integrated Terminal. Now type the following below:

  1. dotnet new console
  2. dotnet restore
  3. dotnet run
like image 97
Alf Moh Avatar answered Oct 11 '22 15:10

Alf Moh


The best way at this present time to create a console application is to create a DNX style Console Application.

I would advise that you download and install the generator-aspnet Yeoman generator and use that to generate a DNX Console application. Once you've got generator-aspnet installed, in your terminal/console app type yo aspnet and select Console Application.

Here's a thorough guide to creating a DNX Console application which will work with VS Code: http://docs.asp.net/en/latest/dnx/console.html

like image 35
Will L Avatar answered Oct 11 '22 14:10

Will L