共用方式為


dotnet workload 命令輸出變更

下列命令的輸出已有變更:

  • dotnet workload list --machine-readable
  • dotnet workload install --print-download-link-only
  • dotnet workload update --print-download-link-only
  • dotnet workload update --print-rollback

先前,受影響的命令會輸出下列內容:

  • 自訂剖析的開始和結束界限線,以找出 JSON 本文。
  • 命令在正常作業期間輸出的任何其他記錄文字。
  • JSON 本文。

現在,這些命令只會輸出 JSON 本文。

先前的行為

先前,受影響的 dotnet workload 命令會產生類似下列的命令 dotnet workload list --machine-readable 輸出:

Failed to update the advertising manifest microsoft.net.sdk.tvos: Unable to load the service index for source https://REDACTED/index.json..
Failed to update the advertising manifest microsoft.net.sdk.android: Unable to load the service index for source https://REDACTED/index.json..
Failed to update the advertising manifest microsoft.net.sdk.maui: Unable to load the service index for source https://REDACTED/index.json..
Failed to update the advertising manifest microsoft.net.workload.emscripten: Unable to load the service index for source https://REDACTED/index.json..
Failed to update the advertising manifest microsoft.net.sdk.macos: Unable to load the service index for source https://REDACTED/index.json..
Failed to update the advertising manifest microsoft.net.sdk.maccatalyst: Unable to load the service index for source https://REDACTED/index.json..
Failed to update the advertising manifest microsoft.net.sdk.ios: Unable to load the service index for source https://REDACTED/index.json..
Failed to update the advertising manifest microsoft.net.workload.mono.toolchain: Unable to load the service index for source https://REDACTED/index.json..
==workloadListJsonOutputStart==
{"installed":["macos","ios"],"updateAvailable":[{"existingManifestVersion":"12.0.101-preview.10.249","availableUpdateManifestVersion":"12.0.101-preview.10.251","description":".NET SDK Workload for building macOS applications.","workloadId":"macos"},{"existingManifestVersion":"15.0.101-preview.9.31","availableUpdateManifestVersion":"15.0.101-preview.10.251","description":".NET SDK Workload for building iOS applications.","workloadId":"ios"}]}
==workloadListJsonOutputEnd==

新的行為

從 .NET 9 開始,受影響的 dotnet workload 命令會產生類似下列的命令 dotnet workload list --machine-readable 輸出:

{"installed":["macos","ios"],"updateAvailable":[{"existingManifestVersion":"12.0.101-preview.10.249","availableUpdateManifestVersion":"12.0.101-preview.10.251","description":".NET SDK Workload for building macOS applications.","workloadId":"macos"},{"existingManifestVersion":"15.0.101-preview.9.31","availableUpdateManifestVersion":"15.0.101-preview.10.251","description":".NET SDK Workload for building iOS applications.","workloadId":"ios"}]}

導入的版本

.NET 9 Preview 1

中斷性變更的類型

此變更為行為變更

變更原因

在要求 JSON 時,許多 CLI 產品只會輸出 JSON。 我們想要仿效,也只輸出 JSON。 透過這項變更,在其工具中使用這些命令的客戶不需要任何自訂剖析。 您可以將這些命令的輸出直接傳送至 JSON 剖析器,而不是中繼剖析邏輯。

如果您的程式碼在剖析 JSON 之前搜尋下列開始和結束界限文字,您就不再需要搜尋這些界限的輸出。 相反地,請考慮這些命令的輸出直接成為 JSON 本文。

  • ==workloadListJsonOutputStart==/==workloadListJsonOutputEnd==
  • ==allPackageLinksJsonOutputStart==/==allPackageLinksJsonOutputEnd==
  • ==workloadRollbackDefinitionJsonOutputStart==/==workloadRollbackDefinitionJsonOutputEnd==

受影響的 API

N/A