Now that dotnet core tools have been released I thought it would be good to look into the dotnet cli. This is a new command line interface to build, manage, compile and run dotnet core based applications
You will need to install the latest version of dotnet core. Simply install it at dot.net. You can find installers for Mac, Windows, or Linux. You should be able to read the docs and get going.
Like most command lines you can call dotnet --help and get a list of main functions.
So it appears we can get a console app, class library, unit tests, aspnet core, webapp the list goes on and on. Lets do dotnet new mvc.
The results are a complete mvc application. Now lets restore the nuget packages with dotnet restore. Afterwards lets run the project with dotnet run. The results should be the app running on port 5000.
Now I’d like to add my favorite statsd client StatsN. This is as simple as running dotnet add package StatsN. To get a directory with our application ready to be ran we can run dotnet publish and one will be created in ./bin/Debug/netcoreapp1.1/publish/ If we want to compile in release mode we need to specify dotnet publish -c Release.
Finally we can even use the cli to create a solution file dotnet new sln and add we can add projects with dotnet new sln add <MyProject>
Overall the cli is simple and easy to use. The --help command works on all verbs no matter how deep, and can be very handy. The second major version of the CLI planned, includes the ability to globally install tools. This will allow any developer to extend the dotnet cli with their own code. Sometime soon you may be able to dotnet tool install awesome and then dotnet awesome.
Overall I’m both impressed, and speechless with how fast microsoft has moved its almost 20 year old platform into a very modern environment to work in. The new csproj files are easy to understand, and work 100% with my old csproj files. Backward compatibility means I can just move my stuff forward slowly, and don’t have to port 10 years of work.