.NET Core CLI 筆者常用指令整理

.NET Core CLI 常用指令

Table of Cotents

前言#

記錄筆者常用的 .NET Core 指令

CLI 指令#

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
$ dotnet --version (顯示Version)
$ dotnet new [type of project] -n [project name]
$ dotnet new console (new console project)
$ dotnet new mvc (new mvc project)
$ dotnet new webapi (new api project)
$ dotnet add package (加入NeGet套件)
# EF Farmwork > 相依套件
$ dotnet add package Microsoft.EntityFrameworkCore.SqlServer
$ dotnet add package Microsoft.EntityFrameworkCore.Design
$ dotnet add package Microsoft.EntityFrameworkCore.Tools
# 建置
$ dotnet build (建置) -o [ouput path]
# 清除建置
$ dotnet clean
# 執行
$ dotnet run
# 發行
$ dotnet publish
& -c Release
# 限定版本 (win10x64)
& -r win10-x64 --self-contained
# 全部包裝成執行檔 exe
& -r win10-x64 --no-self-contained