1) Installed Visual Studio Code
2) Installed .Net Core
3) Create a project directory
Open Terminal and go to your working directory
‘mkdir HelloWorld'
‘cd HelloWorld’
4) Get yourself the default template; lucky for us dotnet gives us a simple option.
‘dotnet new’
This command will give you two files; “Program.cs” and “project.json” in the project directory.
5) Build the default project
‘dotnet build’
This will return two error messages shown below because we’re missing some basic dependencies.
"Project HelloWorld does not have a lock file.
Project HelloWorld does not have a lock file.”
6) Get your dependancies where are noted in project.js
‘dotnet restore’
If you’ve never attempted this before your system will head off to the Internet and download everything you need. If you’re done this at any stage before nuget should just get them from the cache.
7) Try your build again and it should succeed
‘dotnet build'
‘dotnet run'
‘dotnet run'
Building and running with Visual Studio Code
Having to run on the commend line is a bit of a pain, so this is how you can do it within the Visual Studio Code IDE (VSC).1) Click the debug icon in VSC and then then Play icon in the toolbar.
2) Click Close and then hit Play button again and “Configure Task Running” which gives you a list of different options to choose from. I picked “.Net Core"
3) At this point you should end up with a new "tasks.json” file within your project.
4) Open this and change the “taskName” from “build” to “run” and save.
6) type ‘run’ and select “Tasks: Run Task” and within the output window you should see the results.
8) This will create a new keybindings.json file where you can override existing or add new bindings. I added the following and saved the file:
[{
"key": "shift+cmd+b",
"command": "workbench.action.tasks.runTask",
"when": "editorTextFocus"
}
]
9) Now all I need to compile/run is hit the short cut keys.