. NET core installation and initial experience
As Microsoft's next-generation technology,. NET core has great advantages in developing cross-platform, micro-services, and is also more closely related to modern coding habits. A long time after the release of version 2.0, the recent decision to learn and experience.
Installation
As a. NET programmer, the most convenient development tool is, of course, Visual Studio. Although. NET core can be developed in tools such as vs code, I still use Visual Studio as a development tool.
Install Visual Studio 2017 first, download and install it yourself, and check. NET core when you install.
When the installation is complete, open the console to verify that the installation is successful. In console input:
dotnet --version
If the installation succeeds, the current. NET Core version number is displayed
Hello World
No matter how complex the program, our best start is to complete a Hello World instance first. We open vs, create a new console application (. NET core), enter the project name, and then OK.
The entrance to the program is still the static main method of the Programs class, in which the code for the output of Hello World has been completed for us:
class Program{ static void Main(string[] args) { Console.WriteLine("Hello World!"); }}
Run the program and you can see the console output Hello World!
string.
Using the ASP. NET Core
Next we create a ASP.NET Core
project to experience.
We choose to create an empty website, when the project is created, you will see two. cs files in the root directory, respectively, Program.cs and Startup.cs files.
A web ASP.NET Core
site is run as a console application, and a web hosting program is created from the console to handle Web requests, similar to node. js, Golang, compared to a traditional ASP.
When we run this project, we open a browser that displays the string in the browser Hello world!
.
. NET core installation and initial experience