The Windows development environment is built:
1. Install the latest vscode,;
2. Install the latest. NET CORE,;
3. Get C # extension in VS Code;
First, create a C # project
1. Open the VS Code and open the pre-defined folder from the command line, such as: E:\NetCore\demo;
Use the quick key to bring up the command line window, Ctrl + '; In fact, there are two ways to do this, directly through the Windows command line. The prerequisite is that the. NET CORE SDK is installed.
2. Enter dotnet new console, which will generate items with the same name as the folder, such as Demo.csproj;
3. Enter dotnet restore to compile the project;
4. Run the project, dotnet run.
Second, the command line to use, can be viewed through dotnet help.
There is also a more important command, directly using dotnet new to view Help, and you can view the creation of various projects such as: Console programs, Web projects, Web MVC, class libraries, test projects, and solutions.
This command should also have occurred since Dotnet Core 1.1, before the project was created in JSON format, and then back to the csproj solution pattern.
Three, small try to create a WEB MVC program
1. Open vs Code and navigate to the folder you want, such as: E:\MvcDemo1
2. Use the shortcut key Ctrl + ', this time the bottom right corner will pop up terminal cmd.exe window
3. Using dotnet new Mvc-n Mvcdemo
4. Return to the Left menu window to view the created project and click on a file
Click to wait a moment, in the Output window will see the download Omnisharp package, waiting for the download to complete ...
It seems that the domestic download speed is relatively slow, if you encounter the download package failed, can be reopened, will be downloaded again.
After downloading Omnisharp, you will download. NET Core Debugger ...
5. Run the MVC program, click the Debug icon in the left menu bar, select. NET Core Launch (WEB), then click Start Debugging
Run results
6. Publish A. NET Core application to view official Microsoft documentation
Using dotnet Publish to publish a program, you should perform dotnet restore restore and dotnet build project before publishing
The steps are as follows:
6.1 Build dependencies, dotnet Restore
6.2 Build Project, dotnet Build
6.3 Release project, dotnet publish-f netcoreapp1.1-c release
dotnet publish [<project>] [-f|--framework] [-r|--runtime] [-o|--output] [-c|--configuration] [--version-suffix ] [-v|--verbosity] [-h|--help]
Specify the target frame-f|--framework <framework>, please refer to
Specify runtime RIDs,-r|--runtime <RUNTIME_IDENTIFIER> concrete rids refer to
The test found that the specified RID is always released unsuccessfully, not clear where the problem is, such as someone told, extremely grateful.
Later used, dotnet publish-f netcoreapp1.1-c release, the release was successful. The resulting file can be seen in the Bin/release/netcoreapp1.1/publish
If there is any mistake, please testify, thank you.