下列命令的輸出中有變更:
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