I realy want to get my hands dirty with the new .Net core hype so i thought may be not its the time. Before going crazy on the visual studio i decided to use the .net core using the command line. So lets start
To begin with you need to have .net installed. If you have VS 2017 then .Net core is already part of it but if you dont have it you can download it from here
To verify if you have successfully installed .net core open command prompt and run the command dotnet you will get this
I will do it in certain steps so that it is more clear
Lets create a directory where we work in so i will create a new directory called ‘dotnetHelloWorld’
Lets create our first project. Now we can create differnt types of project in c#, F# and VB but lets start by creating a C# console project and for that we need to run the command ‘dotnet new console’.
In our directory there will be two files created
Now lets build the project so for that we need to run the command ‘dotnet build’ and when i did that i got some errors. if you see the error list it complains about the types not defined and it cannot find the library for those system types
To fix that we need to restore before build which will restore all the required nuget packages. So run ‘dotnet restore’
Lets give another try to build the project so run ‘dotnet build’ and you will get this
After building now we will try to run it and if you notice the file structure there is no exe file generated in the bin folder that you can double click and run its only the pdb and the dll as .net core will generate the libraries so how to run it? Well dotnet core have solved this problem by giving a command so if you run ‘dotnet run’ you will see the output.
The reason to use it via the command is that it could be used on any platform and could be really handy on build machines.