VS Code 常用命令记录

1. 创建解决方案

例:dotnet new sln -o HelloWorld.Solutions

其中 -o 表示输出文件夹

2.创建类库、web、mvc、webapi等项目

例:dotnet new classlib/web/mvc/webapi -o xxxx

3.将创建好的类库、web、mvc、webapi 加入sln

例:dotnet sln add HelloWorld.WebApi/HelloWorld.WebApi.csproj

4.添加引用

示例
添加项目引用:
dotnet add app/app.csproj reference lib/lib.csproj

添加多个项目引用:
dotnet add reference lib1/lib1.csproj lib2/lib2.csproj

使用 glob 模式在 Linux/Unix 上添加多个项目引用:
dotnet add app/app.csproj reference **/*.csproj

<ItemGroup>

<projectReference Include="..HelloWorld.CoreHelloWorld.Core.csproj"/>
</ItemGroup>

5.引入插件(nuget packages)

例:引入 swagger
dotnet add TodoApi.csproj package Swashbuckle.AspNetCore

将 Newtonsoft.Json NuGet 包添加到项目:
dotnet add package Newtonsoft.Json

向项目添加特定版本的包:
dotnet add ToDo.csproj package Microsoft.Azure.DocumentDB.Core -v 1.0.0

使用特定的 NuGet 源添加包:
dotnet add package Microsoft.AspNetCore.StaticFiles -s https://dotnet.myget.org/F/dotnet-core/api/v3/index.json

从当前目录中的项目删除 Newtonsoft.Json NuGet 包:
dotnet remove package Newtonsoft.Json

原文地址:https://www.cnblogs.com/billyang/p/7838474.html