Core dotnet Command Daquan
dotnet command Daquan, let you understand the dotnet command.
This article will dotnet all commands with an instance string, allowing you to play the dotnet command.
The authoring environment for this article is Windows, and the dotnet command applies to other systems as well.
With VS Code you can develop. NET Core on Linux, MAC.
Here is the dotnet command directory:
Dotnet-new
Dotnet-restore
Dotnet-run
Dotnet-build
Dotnet-test
Dotnet-pack
Dotnet-publish
Let's talk about it in detail now.
Create (dotnet New)
First we create a project where we create the console program.
dotnet New
dotnet More commands please refer to help.
Restore (dotnet Restore and dotnet pack)
We are creating a class lib, which is the library of classes.
Dotnet New-t Lib
Once created, write some of your own code and then package it.
I've written two methods and now I'm packing.
dotnet Restore
Dotnet Pack
How does the. NET Core Add an offline reference package? Now the answer is revealed.
After packing, we add applib to the app's Project.json .
Add and then cut to the app directory and then restore.
The command used for the restore is:dotnet restore-f E:\dotnet\applib\bin\Debug\
Dotnet the path of the RESTORE-F package
This allows us to invoke the Applib method directly in the project.
We write the corresponding call in the code and execute the program. You can see the result of the correct output of class lib.
Run (dotnet build and dotnet Run)
Take the app as an example:
dotnet build Compile code
dotnet Run execution program
dotnet Xx.dll is also an executive program
Test (dotnet Test)
Here we are going to create a new folder and a project.
New test project: dotnet new-t xunittest
Create a new project we can add a test method inside, here I run the test directly.
dotnet Restore
dotnet Test
Release (dotnet publish)
The point is that publishing the project makes it possible to run across platforms.
dotnet Publish Default Publishing
Navigate to the Publish directory after publishing and use dotnet Xx.dll to execute the app.
Below to publish across platforms.
can refer to my previous article: http://www.cnblogs.com/linezero/p/5475246.html
in Project.json join the runtimes node to comment out "type": "Platform".
First we're going to dotnet restore .
Here I restore some long time, we wait patiently.
dotnet Publish-r win10-x64
Once published here, you can navigate directly to the Publish publish directory and execute app.exe .
dotnet Publish-r ubuntu.14.04-x64
Upload the Publish folder to the Linux system, set the app's permissions to executable, and then./app can run.
dotnet Publish-r Specify the system ID in the runtimes node
Dotnet This is explained, do not know whether people understand. This article is designed to make a point, more features need to be discovered by everyone.
If you think this article is helpful to you, please click " recommend ", thank you.
Core dotnet Command Daquan