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 预览版 1

中断性变更的类型

此更改为行为更改

更改原因

请求 JSON 时,许多 CLI 产品仅输出 JSON。 我们希望效仿,并且只输出 JSON。 通过此更改,在其工具中使用这些命令的客户不需要任何自定义分析。 可以将这些命令的输出直接传递到 JSON 分析器,而不是中间分析逻辑。

如果代码在分析 JSON 之前搜索以下开始和结束边界文本,则不再需要搜索这些边界的输出。 相反,请考虑这些命令的输出直接成为 JSON 正文。

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

受影响的 API

不适用