Fix for --print-download-link only #27064
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes --print-download-links for VSMac
Description
The prior fix for this #26369 had some limitations. It didn't work correctly in non-band versions of the SDK (ie 6.0.401 wouldn't work even though 6.0.400 would work). It also didn't correctly fall back. In the case that we're likely to see in VSMac, a 6.0.4xx SDK will have 6.0.3xx manifests and running with --sdk-version 7.0.100. Without this change, it was finding the 7.0.100 versions of manifests but not falling back to both 6.0.400 and 6.0.300. As such, the 6.0.300 manifests were being left as older versions. Now we check the –sdk-version value, the current sdk band, and the fallback band.
Customer Impact
VSMac upgrades customers would be left on older versions of the workloads
Testing
See below. Tested using sdk-version for both future and past versions. Tested install still works. Tested with fallback and without. Tested that it would only print links for components not currently installed.
Risk
This is fairly limited in scope to just the print-download link scnario.
Regression
No, the prior fix was incomplete.
6.0.4xx port of the changes from #27011
Updated the fix to clean up the code, fallback to the installed manifest band, and use the installed sdk for the workload resolver.
Testing:
6.0.401-dev SDK with maui installed and 6.0.300 manifests
no SDK version --> 6.0.300 for runtime and 6.0.400 for the rest of the workloads
PS C:\test\bug> dotnet workload update --print-download-link-only
==allPackageLinksJsonOutputStart==
[
"https://api.nuget.org/v3-flatcontainer/microsoft.net.sdk.android.manifest-6.0.400/32.0.448/microsoft.net.sdk.android.manifest-6.0.400.32.0.448.nupkg",
"https://api.nuget.org/v3-flatcontainer/microsoft.net.sdk.ios.manifest-6.0.400/15.4.447/microsoft.net.sdk.ios.manifest-6.0.400.15.4.447.nupkg",
"https://api.nuget.org/v3-flatcontainer/microsoft.net.sdk.maccatalyst.manifest-6.0.400/15.4.447/microsoft.net.sdk.maccatalyst.manifest-6.0.400.15.4.447.nupkg",
"https://api.nuget.org/v3-flatcontainer/microsoft.net.sdk.macos.manifest-6.0.400/12.3.447/microsoft.net.sdk.macos.manifest-6.0.400.12.3.447.nupkg",
"https://api.nuget.org/v3-flatcontainer/microsoft.net.sdk.maui.manifest-6.0.400/6.0.486/microsoft.net.sdk.maui.manifest-6.0.400.6.0.486.nupkg",
"https://api.nuget.org/v3-flatcontainer/microsoft.net.sdk.tvos.manifest-6.0.400/15.4.447/microsoft.net.sdk.tvos.manifest-6.0.400.15.4.447.nupkg",
"https://api.nuget.org/v3-flatcontainer/microsoft.net.workload.mono.toolchain.manifest-6.0.300/6.0.8/microsoft.net.workload.mono.toolchain.manifest-6.0.300.6.0.8.nupkg",
"https://api.nuget.org/v3-flatcontainer/microsoft.net.workload.emscripten.manifest-6.0.300/6.0.4/microsoft.net.workload.emscripten.manifest-6.0.300.6.0.4.nupkg",
"https://api.nuget.org/v3-flatcontainer/microsoft.maui.core.ref.android/6.0.486/microsoft.maui.core.ref.android.6.0.486.nupkg",
...
Future version --> 7.0.100 for runtime, 6.0.400 for the rest of the workloads
PS C:\test\bug> dotnet workload update --print-download-link-only --sdk-version 7.0.100
==allPackageLinksJsonOutputStart==
[
"https://api.nuget.org/v3-flatcontainer/microsoft.net.sdk.android.manifest-6.0.400/32.0.448/microsoft.net.sdk.android.manifest-6.0.400.32.0.448.nupkg",
"https://api.nuget.org/v3-flatcontainer/microsoft.net.sdk.ios.manifest-6.0.400/15.4.447/microsoft.net.sdk.ios.manifest-6.0.400.15.4.447.nupkg",
"https://api.nuget.org/v3-flatcontainer/microsoft.net.sdk.maccatalyst.manifest-6.0.400/15.4.447/microsoft.net.sdk.maccatalyst.manifest-6.0.400.15.4.447.nupkg",
"https://api.nuget.org/v3-flatcontainer/microsoft.net.sdk.macos.manifest-6.0.400/12.3.447/microsoft.net.sdk.macos.manifest-6.0.400.12.3.447.nupkg",
"https://api.nuget.org/v3-flatcontainer/microsoft.net.sdk.maui.manifest-6.0.400/6.0.486/microsoft.net.sdk.maui.manifest-6.0.400.6.0.486.nupkg",
"https://api.nuget.org/v3-flatcontainer/microsoft.net.sdk.tvos.manifest-6.0.400/15.4.447/microsoft.net.sdk.tvos.manifest-6.0.400.15.4.447.nupkg",
"https://api.nuget.org/v3-flatcontainer/microsoft.net.workload.mono.toolchain.manifest-7.0.100/7.0.0-preview.7.22375.6/microsoft.net.workload.mono.toolchain.manifest-7.0.100.7.0.0-preview.7.22375.6.nupkg",
"https://api.nuget.org/v3-flatcontainer/microsoft.net.workload.emscripten.manifest-7.0.100/7.0.0-preview.7.22361.2/microsoft.net.workload.emscripten.manifest-7.0.100.7.0.0-preview.7.22361.2.nupkg",
"https://api.nuget.org/v3-flatcontainer/microsoft.maui.core.ref.android/6.0.486/microsoft.maui.core.ref.android.6.0.486.nupkg",
...
Past version --> this used the 6.0.300 versions for all manifests and packs
PS C:\test\bug> dotnet workload update --print-download-link-only --sdk-version 6.0.300
==allPackageLinksJsonOutputStart==
[
"https://api.nuget.org/v3-flatcontainer/microsoft.net.sdk.android.manifest-6.0.300/32.0.440/microsoft.net.sdk.android.manifest-6.0.300.32.0.440.nupkg",
"https://api.nuget.org/v3-flatcontainer/microsoft.net.sdk.ios.manifest-6.0.300/15.4.328/microsoft.net.sdk.ios.manifest-6.0.300.15.4.328.nupkg",
"https://api.nuget.org/v3-flatcontainer/microsoft.net.sdk.maccatalyst.manifest-6.0.300/15.4.328/microsoft.net.sdk.maccatalyst.manifest-6.0.300.15.4.328.nupkg",
"https://api.nuget.org/v3-flatcontainer/microsoft.net.sdk.macos.manifest-6.0.300/12.3.328/microsoft.net.sdk.macos.manifest-6.0.300.12.3.328.nupkg",
"https://api.nuget.org/v3-flatcontainer/microsoft.net.sdk.maui.manifest-6.0.300/6.0.419/microsoft.net.sdk.maui.manifest-6.0.300.6.0.419.nupkg",
"https://api.nuget.org/v3-flatcontainer/microsoft.net.sdk.tvos.manifest-6.0.300/15.4.328/microsoft.net.sdk.tvos.manifest-6.0.300.15.4.328.nupkg",
"https://api.nuget.org/v3-flatcontainer/microsoft.net.workload.mono.toolchain.manifest-6.0.300/6.0.8/microsoft.net.workload.mono.toolchain.manifest-6.0.300.6.0.8.nupkg",
"https://api.nuget.org/v3-flatcontainer/microsoft.net.workload.emscripten.manifest-6.0.300/6.0.4/microsoft.net.workload.emscripten.manifest-6.0.300.6.0.4.nupkg",
"https://api.nuget.org/v3-flatcontainer/microsoft.maui.core.ref.android/6.0.419/microsoft.maui.core.ref.android.6.0.419.nupkg",
7.0.200 was the same as no version.