1. First create a project folder, such as E:\CoreProjects
Use the cmd command to enter the new folder
2. Create a HelloWorld project
Command: dotnet new Console-o HelloWorld
The following indicates a successful creation. We can see a project folder with a HelloWorld file in the Created project folder (a console hypervisor)
3. Running HelloWorld
Use the cmd command to enter the newly generated HelloWorld file
Execute command dotnet Run
Output Hello world!
It means that the. NET core program is complete!
4. Auto-generated HelloWorld program
5. Extension programs
Of course we can extend the Program.cs arbitrarily, such as extending a simple bubble sort.
5.1 Modify the Program.cs code as follows:
5.2 Execute Command dotnet build, the following message appears, the green build succeeded indicates that the compilation was successful.
5.3 Run again
Execute command dotnet run with the following result
Of course I can add a new class file, do not show it.
6. Command description
$ dotnet NEW: Creates a new project, configuration file, or solution based on the specified template.
$ dotnet Restore: called to NuGet (. NET Package Manager) to restore the dependency tree. NuGet parses the hello.csproj file, the dependencies described in the download file (or gets from the computer cache), and writes the obj/project.assets.json file. Project.assets.json files are required to compile and run.
$ dotnet Build: Build the project and all its dependencies
$ dotnet Run: called dotnet build to ensure that the target to be generated is generated and then called to dotnet <assembly.dll> run the target application.
$ dotnet Publish: Package the application and its dependencies into a folder to deploy to a managed system.
7 References
Https://docs.microsoft.com/zh-cn/dotnet/core/tools/dotnet-new?tabs=netcore2x
Start learning from HelloWorld. NET Core