how to run c# code in visual studio code code example
Example 1: how to make a C# application visual studio code
mkdir MyApp; cd MyApp;
dotnet new console
Example 2: vs code run and build task c#
"tasks": [
{
"label": "build",
"command": "dotnet",
"type": "shell",
"args": [
"build",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"group": "build",
"presentation": {
"reveal": "silent",
"echo": false
},
"problemMatcher": "$msCompile"
},
{
"label": "run",
"dependsOn": ["build"],
"command": "dotnet",
"args": [
"run"
],
"group": {
"kind": "build",
"isDefault": true
},
"presentation": {
"reveal": "always",
"echo": false
}
}
]
Example 3: how to run csharp in visual studio code
/*
You should have a application if you want to create a application go
the folder which is your project now use the command in the dir use the
command dotnet new console to intialize it as a console application. Now
You will the a file called {You workspace}.csproj go to the file and run it
*/