dotnet remove referencedotnet remove reference

本文適用于:✓ .net CORE 1.x sdk .net core 2.x sdkThis article applies to: ✓ .NET Core 1.x SDK .NET Core 2.x SDK


dotnet remove reference - 移除專案對專案參考。dotnet remove reference - Removes project-to-project references.


dotnet remove [<PROJECT>] reference [-f|--framework] <PROJECT_REFERENCES> [-h|--help]


dotnet remove reference 命令提供方便的選項,以從專案中移除專案參考。The dotnet remove reference command provides a convenient option to remove project references from a project.



目標專案檔。Target project file. 如果未指定,命令會在目前的目錄中搜尋一個專案檔。If not specified, the command searches the current directory for one.


要移除的專案對專案 (P2P) 參考。Project-to-project (P2P) references to remove. 您可以指定一或多個專案。You can specify one or multiple projects. 以 Unix/Linux 為基礎的終端機上支援 Glob 模式 (英文)Glob patterns are supported on Unix/Linux based terminals.



印出命令的簡短說明。Prints out a short help for the command.

-f|--framework <FRAMEWORK>

只有在以特定架構為目標時,才能移除參考。Removes the reference only when targeting a specific framework.


從指定的專案中移除專案參考:Remove a project reference from the specified project:

dotnet remove app/app.csproj reference lib/lib.csproj

從目前目錄中的專案移除多個專案參考:Remove multiple project references from the project in the current directory:

dotnet remove reference lib1/lib1.csproj lib2/lib2.csproj

在 Unix/Linux 上使用 Glob 模式移除多個專案參考︰Remove multiple project references using a glob pattern on Unix/Linux:

dotnet remove app/app.csproj reference **/*.csproj