dotnet msbuilddotnet msbuild

本主題適用於:✓ .NET Core 1.x SDK .NET Core 2.x SDKThis topic applies to: ✓ .NET Core 1.x SDK .NET Core 2.x SDK

名稱Name

dotnet msbuild - 建置專案和其所有相依性。dotnet msbuild - Builds a project and all of its dependencies.

概要Synopsis

dotnet msbuild <msbuild_arguments> [-h]

說明Description

dotnet msbuild 命令可存取完整功能的 MSBuild。The dotnet msbuild command allows access to a fully functional MSBuild.

此命令與現有的 MSBuild 命令列用戶端僅針對 SDK 樣式專案具有完全相同的功能。The command has the exact same capabilities as the existing MSBuild command-line client for SDK-style project only. 選項完全一樣。The options are all the same. 如需可用選項的詳細資訊,請參閱 MSBuild 命令列參考For more information about the available options, see the MSBuild Command-Line Reference.

dotnet build 命令等同於 dotnet msbuild -restore -target:BuildThe dotnet build command is equivalent to dotnet msbuild -restore -target:Build. dotnet build 較常用來建置專案,但 dotnet msbuild 可提供您較多的控制權。dotnet build is more commonly used for building projects, but dotnet msbuild gives you more control. 例如,如果您有想要執行的特定目標 (但不執行建置目標),您可能會想要使用 dotnet msbuildFor example, if you have a specific target you want to run (without running the build target), you probably want to use dotnet msbuild.

範例Examples

  • 建置專案和其相依性:Build a project and its dependencies:

    dotnet msbuild
    
  • 使用發行組態來建置專案和其相依性︰Build a project and its dependencies using Release configuration:

    dotnet msbuild -p:Configuration=Release
    
  • 執行發行目標並針對 osx.10.11-x64 RID 發行:Run the publish target and publish for the osx.10.11-x64 RID:

    dotnet msbuild -t:Publish -p:RuntimeIdentifiers=osx.10.11-x64
    
  • 查看整個專案和 SDK 包含的所有目標:See the whole project with all targets included by the SDK:

    dotnet msbuild -pp