dotnet slndotnet sln

12/07/2020

本文内容

本文适用于: ✔️ .NET Core 2.x SDK 及更高版本This article applies to: ✔️ .NET Core 2.x SDK and later versions

“属性”Name

dotnet sln - 在 .NET 解决方案文件中列出或修改项目。dotnet sln - Lists or modifies the projects in a .NET solution file.

摘要Synopsis

dotnet sln [] [command]

dotnet sln [command] -h|--help

描述Description

使用 dotnet sln 命令,可以便捷地在解决方案文件中列出和修改项目。The dotnet sln command provides a convenient way to list and modify projects in a solution file.

若要使用 dotnet sln 命令,必须存在解决方案文件。To use the dotnet sln command, the solution file must already exist. 如果需要创建一个解决方案文件,请使用 dotnet new 命令,如下例所示:If you need to create one, use the dotnet new command, as in the following example:

dotnet new sln

自变量Arguments

SOLUTION_FILE

要使用的解决方案文件。The solution file to use. 如果省略此参数,此命令会搜索当前目录来获取一个解决方案文件。If this argument is omitted, the command searches the current directory for one. 如果未找到解决方案文件或找到多个解决方案文件,则该命令将失败。If it finds no solution file or multiple solution files, the command fails.

选项Options

-h|--help

打印出有关如何使用命令的说明。Prints out a description of how to use the command.

命令Commands

list

列出解决方案文件中的所有项目。Lists all projects in a solution file.

摘要Synopsis

dotnet sln list [-h|--help]

自变量Arguments

SOLUTION_FILE

要使用的解决方案文件。The solution file to use. 如果省略此参数,此命令会搜索当前目录来获取一个解决方案文件。If this argument is omitted, the command searches the current directory for one. 如果未找到解决方案文件或找到多个解决方案文件,则该命令将失败。If it finds no solution file or multiple solution files, the command fails.

选项Options

-h|--help

打印出有关如何使用命令的说明。Prints out a description of how to use the command.

add

将一个或多个项目添加到解决方案文件。Adds one or more projects to the solution file.

摘要Synopsis

dotnet sln [] add [--in-root] [-s|--solution-folder ] [...]

dotnet sln add [-h|--help]

自变量Arguments

SOLUTION_FILE

要使用的解决方案文件。The solution file to use. 如果未指定,此命令会搜索当前目录以获取一个解决方案文件,如果找到多个解决方案文件,则该命令将失败。If it is unspecified, the command searches the current directory for one and fails if there are multiple solution files.

PROJECT_PATH

要添加到解决方案的一个或多个项目的路径。The path to the project or projects to add to the solution. Unix/Linux shell glob 模式扩展由 dotnet sln 命令正确处理。Unix/Linux shell globbing pattern expansions are processed correctly by the dotnet sln command.

选项Options

-h|--help

打印出有关如何使用命令的说明。Prints out a description of how to use the command.

--in-root

将项目放在解决方案的根目录下,而不是创建解决方案文件夹。Places the projects in the root of the solution, rather than creating a solution folder. 自 .NET Core 3.0 SDK 起可用。Available since .NET Core 3.0 SDK.

-s|--solution-folder

要将项目添加到的目标解决方案文件夹路径。The destination solution folder path to add the projects to. 自 .NET Core 3.0 SDK 起可用。Available since .NET Core 3.0 SDK.

remove

从解决方案文件中删除一个或多个项目。Removes a project or multiple projects from the solution file.

摘要Synopsis

dotnet sln [] remove [...]

dotnet sln [] remove [-h|--help]

自变量Arguments

SOLUTION_FILE

要使用的解决方案文件。The solution file to use. 如果保留未指定,此命令会搜索当前目录以获取一个解决方案文件,如果找到多个解决方案文件,则该命令将失败。If is left unspecified, the command searches the current directory for one and fails if there are multiple solution files.

PROJECT_PATH

要添加到解决方案的一个或多个项目的路径。The path to the project or projects to add to the solution. Unix/Linux shell glob 模式扩展由 dotnet sln 命令正确处理。Unix/Linux shell globbing pattern expansions are processed correctly by the dotnet sln command.

选项Options

-h|--help

打印出有关如何使用命令的说明。Prints out a description of how to use the command.

示例Examples

在解决方案中列出项目:List the projects in a solution:

dotnet sln todo.sln list

将一个 C# 项目添加到解决方案中:Add a C# project to a solution:

dotnet sln add todo-app/todo-app.csproj

从解决方案中删除一个 C# 项目:Remove a C# project from a solution:

dotnet sln remove todo-app/todo-app.csproj

将多个 C# 项目添加到解决方案的根目录中:Add multiple C# projects to the root of a solution:

dotnet sln todo.sln add todo-app/todo-app.csproj back-end/back-end.csproj --in-root

将多个 C# 项目添加到解决方案中:Add multiple C# projects to a solution:

dotnet sln todo.sln add todo-app/todo-app.csproj back-end/back-end.csproj

从解决方案中删除多个 C# 项目:Remove multiple C# projects from a solution:

dotnet sln todo.sln remove todo-app/todo-app.csproj back-end/back-end.csproj

使用 glob 模式(仅限 Unix/Linux)将多个 C# 项目添加到解决方案中:Add multiple C# projects to a solution using a globbing pattern (Unix/Linux only):

dotnet sln todo.sln add **/*.csproj

使用 globbing 模式(仅限 Windows PowerShell)将多个 C# 项目添加到解决方案中:Add multiple C# projects to a solution using a globbing pattern (Windows PowerShell only):

dotnet sln todo.sln add (ls -r **/*.csproj)

使用 glob 模式(仅限 Unix/Linux)将多个 C# 项目从解决方案中删除:Remove multiple C# projects from a solution using a globbing pattern (Unix/Linux only):

dotnet sln todo.sln remove **/*.csproj

使用 globbing 模式(仅限 Windows PowerShell)将多个 C# 项目从解决方案中删除:Remove multiple C# projects from a solution using a globbing pattern (Windows PowerShell only):

dotnet sln todo.sln remove (ls -r **/*.csproj)

创建解决方案、控制台应用和两个类库。Create a solution, a console app, and two class libraries. 将项目添加到解决方案,并使用 dotnet sln 的 --solution-folder 选项将类库组织到一个解决方案文件夹中。Add the projects to the solution, and use the --solution-folder option of dotnet sln to organize the class libraries into a solution folder.

dotnet new sln -n mysolution

dotnet new console -o myapp

dotnet new classlib -o mylib1

dotnet new classlib -o mylib2

dotnet sln mysolution.sln add myapp\myapp.csproj

dotnet sln mysolution.sln add mylib1\mylib1.csproj --solution-folder mylibs

dotnet sln mysolution.sln add mylib2\mylib2.csproj --solution-folder mylibs

以下屏幕截图显示了 Visual Studio 2019“解决方案资源管理器”中的结果:The following screenshot shows the result in Visual Studio 2019 Solution Explorer:

linux系统sln命令,dotnet sln相关推荐

  1. Linux系统上部署dotnet core

    Linux系统上部署dotnet core 主要步骤如下: 安装linux Linux下安装dotnet core环境 Linux下部署dotnet core系统 主要步骤如下: 因我公司需要,做一个 ...

  2. linux脚本参数获取时间戳,Linux系统date命令的参数及获取时间戳的方法

    date指令相关用法示例 date 用法: date [OPTION]... [+FORMAT] date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]] ...

  3. Linux系统检测命令有哪些

    2019独角兽企业重金招聘Python工程师标准>>> Linux系统检测命令有哪些 | 浏览:44 | 更新:2015-02-02 10:16 | 标签:linux top:一个命 ...

  4. 【收藏】Linux系统常用命令速查手册(附赠PDF档)

    给大家收集整理了日常常用的Linux系统命令,仅供大家参考. 大家如果觉得文章看起来不太方便,获取<Linux系统常用命令速查手册>.PDF版. 联系小姐姐,备注"liunx命令 ...

  5. 【收藏】Linux系统常用命令速查手册(附PDF下载链接)

    给大家收集整理了日常常用的Linux系统命令,仅供大家参考. 大家如果觉得文章看起来不太方便,可以在+qq. 2 3 5 53 3 1 0 4 6 备注"liunx命令",即可获取 ...

  6. Linux下mknod的作用,Linux系统mknod命令用法

    欢迎来到学习啦,本文介绍Linux系统mknod命令用法 ,欢迎您阅读. mknod 用法: 名字 mknod - 建立块专用或字符专用文件 总览 mknod [options] name {bc} ...

  7. linux系统正常停机的命令,Linux系统重启命令大全

    在进行Linux系统操作的时候,如果出现更换硬件.更改系统配置及死机等情况时,就需要对电脑进行重启,而不同的情形重启的方式也不同,即使用的命令不同,接下来是小编为大家收集的Linux系统重启命令大全, ...

  8. 在Linux系统的命令行中为MySQL创建用户的方法

    这篇文章主要介绍了在Linux系统的命令行中为MySQL创建用户的方法,包括对所建用户的权限管理,需要的朋友可以参考下 要访问一个MySQL服务器,你需要使用一个用户帐号登录其中方可进行.每个MySQ ...

  9. Linux 系统下命令 unrar 的中文版使用说明

    查看英文版,猛戳<Linux 系统下命令 unrar 的英文版使用说明> $ rar --help用法: rar <命令> -<选项 1> -<选项 N> ...

最新文章

  1. superset的安装和使用--docker
  2. 大数据处理的关键架构
  3. 037——VUE中表单控件处理之表单修饰符:lazy/number/trim
  4. VTK:小部件之ImageTracerWidget
  5. php的Snoopy类
  6. MySQL 运维及开发规范
  7. 数据结构--串--KMP
  8. 调研时报表的相关信息
  9. php+jq+添加css,jq如何添加css样式?
  10. 数字万用表怎么检查计算机,数码管怎么测量_如何使用万用表判断数码管的好坏 - 全文...
  11. 2016微信公开课·张小龙演讲全文(下)
  12. 大话墨香泰坦版服务端架设及客户端IP修改
  13. 問題の解決策 [USACO18JAN]Lifeguards P(题解)
  14. Codeforces 982E Billiard exgcd
  15. 简报悦读:教育部取消5类高考加分项目,猿辅导纪录片讲述十年坚守
  16. python中的整型是什么意思_Python中整型的基本介绍(代码示例)
  17. 常见几种在线即时通讯即时聊天在线客服的源代码
  18. 10道集合框架面试题(含解析),来看看你会多少
  19. mysql 支持分区表,mysql表分区的限制
  20. 达梦数据库DCA认证培训总结

热门文章

  1. 振动试验,振动耐久试验,专业环境试验机构,
  2. 微信小程序 IOS中new Date()时间格式不兼容问题
  3. 堆在ROM还是RAM?
  4. Uni-app 初体验
  5. 简单的HTTP代理服务器的实现(基本功能+拓展功能)
  6. CIKM Competition数据挖掘竞赛夺冠算法陈运文
  7. 三星galaxy s4问题解决及快捷操作
  8. MATLAB--基于BP神经网络的手写数字识别
  9. [tyvj2054] 四叶草魔杖 (最小生成树 状压dp)
  10. python爬取音乐排行_Python爬取酷狗Top500的歌曲!够你吹个小牛皮了吧