Overview Of .NET CLI

The .Net Core Command Line Tool is a new tool essential for development in ASP.NET Core. What do I mean by "essential?" Simple, any person or tool that wants to develop in the new platform of Microsoft must use this tool. It is the first layer of development. The VS2015 uses the .Net CLI to build, publish, run and other things. .Net CLI also is cross-platform, that is, it can run in Windows, Apple and Linux and to start with it you must download your distribuition to your SO.
 
You may wonder, "Do  I need to learn this tool?" Those who work with Visual Studio 2015 UPDATE 2 do not need to, because internally the VS will use the .Net CLI. But when you do not use the VS, it will need to be used to develop in platform. Remember, now I can develop in other tools as Visual Studio Code, Sublime, Vim and others. Therefore, learning about it is good!
 
What can get people a little confused it is that some time ago the DNX tool was used. With the arrival of ASP.NET Core RC2, the DNX was replaced by DOTNET and all commands below are installed by default:
  • new
  • restore
  • run
  • build
  • test
  • publish
  • pack
To use the CLI there is a pattern, driver (dotnet) + verb + argument (if there is). For example, after installing the .Net CLI type "dotnet new" in a test folder. You will see that a project was created, but in this example I only used driver + verb. Below I explain the other commands:
  • "dotnet restore" restores all dependecies needed to project.
  • "dotnet buil" compiles the application to validate if there are errors.
  • "dotnet run" runs the application.
  • "dotnet test" runs the tests of application.
  • "dotnet publish" publishes the application.
  • "dotnet pack" creates a Nuget Packages.
To execute the project created previously, we must execute the commands following: "dotnet restore", "dotnet build" and "dotnet run". Restore, build and run is something that all developers understand as a process in development. If you did not change the class created of project, you will see a message in console: "Hello World!".
 
By default these are all the commands included, but you can create your own commands for this access.
Conclusion

The .Net CLI is a tool of the interface to develop in the  .Net platform. Through it, we can create a new project, restore packages, do running and others. With the .Net CLI, code editors can use it for development, because it is cross-platform. Developing in Windows, Linux or Apple already does not make a difference in the new platform of Microsoft.

Up Next
    Ebook Download
    View all
    Learn
    View all