Start learning from HelloWorld. NET Core

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.