Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

install all .NET targeting packs specified by the installed SDKs #11653

Merged
merged 2 commits into from
Feb 20, 2025

Conversation

brettfo
Copy link
Contributor

@brettfo brettfo commented Feb 20, 2025

The NuGet updater Docker image currently installs the .NET 8 and 9 SDKs, but an intereseting scenario was encountered.

Consider a repo with:

  • a project targeting net7.0
  • a NuGet.Config file that explicitly calls the <clear /> directive AND where the remaining NuGet package feeds don't contain any Microsoft.NETCore.App.Ref packages
  • NO global.json file forcing the installation of a 7.0 SDK

If dependency discovery is run on that project it will fail because the current 9.0.x SDK will require the Microsoft.NETCore.App.Ref targeting pack version 7.0.20 but since that package isn't on the remaining private feeds, the operation will fail.

This PR scans the currently installed SDKs and downloads and extracts all required targeting packs.

The result is the following lines reported during a build of the NuGet updater Docker image:

log snippet
#22 [16/16] RUN pwsh /home/dependabot/dependabot-updater/bin/install-targeting-packs.ps1
#22 0.977 Downloading targeting pack [Microsoft.WindowsDesktop.App.Ref/8.0.11]
#22 2.051 Extracting targeting pack [Microsoft.WindowsDesktop.App.Ref/8.0.11] to /usr/local/dotnet/current/packs/Microsoft.WindowsDesktop.App.Ref/8.0.11
#22 2.471 Downloading targeting pack [Microsoft.Windows.SDK.NET.Ref/10.0.17763.53]
#22 2.985 Extracting targeting pack [Microsoft.Windows.SDK.NET.Ref/10.0.17763.53] to /usr/local/dotnet/current/packs/Microsoft.Windows.SDK.NET.Ref/10.0.17763.53
#22 3.170 Downloading targeting pack [Microsoft.Windows.SDK.NET.Ref/10.0.18362.53]
#22 3.709 Extracting targeting pack [Microsoft.Windows.SDK.NET.Ref/10.0.18362.53] to /usr/local/dotnet/current/packs/Microsoft.Windows.SDK.NET.Ref/10.0.18362.53
#22 3.974 Downloading targeting pack [Microsoft.Windows.SDK.NET.Ref/10.0.19041.53]
#22 4.565 Extracting targeting pack [Microsoft.Windows.SDK.NET.Ref/10.0.19041.53] to /usr/local/dotnet/current/packs/Microsoft.Windows.SDK.NET.Ref/10.0.19041.53
#22 4.817 Downloading targeting pack [Microsoft.NETCore.App.Ref/7.0.20]
#22 5.237 Extracting targeting pack [Microsoft.NETCore.App.Ref/7.0.20] to /usr/local/dotnet/current/packs/Microsoft.NETCore.App.Ref/7.0.20
#22 5.831 Downloading targeting pack [Microsoft.WindowsDesktop.App.Ref/7.0.20]
#22 6.245 Extracting targeting pack [Microsoft.WindowsDesktop.App.Ref/7.0.20] to /usr/local/dotnet/current/packs/Microsoft.WindowsDesktop.App.Ref/7.0.20
#22 6.477 Downloading targeting pack [Microsoft.AspNetCore.App.Ref/7.0.20]
#22 6.921 Extracting targeting pack [Microsoft.AspNetCore.App.Ref/7.0.20] to /usr/local/dotnet/current/packs/Microsoft.AspNetCore.App.Ref/7.0.20
#22 7.258 Downloading targeting pack [Microsoft.NETCore.App.Ref/6.0.36]
#22 7.747 Extracting targeting pack [Microsoft.NETCore.App.Ref/6.0.36] to /usr/local/dotnet/current/packs/Microsoft.NETCore.App.Ref/6.0.36
#22 8.013 Downloading targeting pack [Microsoft.WindowsDesktop.App.Ref/6.0.36]
#22 8.398 Extracting targeting pack [Microsoft.WindowsDesktop.App.Ref/6.0.36] to /usr/local/dotnet/current/packs/Microsoft.WindowsDesktop.App.Ref/6.0.36
#22 8.550 Downloading targeting pack [Microsoft.AspNetCore.App.Ref/6.0.36]
#22 9.160 Extracting targeting pack [Microsoft.AspNetCore.App.Ref/6.0.36] to /usr/local/dotnet/current/packs/Microsoft.AspNetCore.App.Ref/6.0.36
#22 9.360 Downloading targeting pack [Microsoft.NETCore.App.Ref/5.0.0]
#22 9.791 Extracting targeting pack [Microsoft.NETCore.App.Ref/5.0.0] to /usr/local/dotnet/current/packs/Microsoft.NETCore.App.Ref/5.0.0
#22 10.01 Downloading targeting pack [Microsoft.WindowsDesktop.App.Ref/5.0.0]
#22 10.62 Extracting targeting pack [Microsoft.WindowsDesktop.App.Ref/5.0.0] to /usr/local/dotnet/current/packs/Microsoft.WindowsDesktop.App.Ref/5.0.0
#22 10.76 Downloading targeting pack [Microsoft.AspNetCore.App.Ref/5.0.0]
#22 11.24 Extracting targeting pack [Microsoft.AspNetCore.App.Ref/5.0.0] to /usr/local/dotnet/current/packs/Microsoft.AspNetCore.App.Ref/5.0.0
#22 11.43 Downloading targeting pack [Microsoft.NETCore.App.Ref/3.1.0]
#22 12.00 Extracting targeting pack [Microsoft.NETCore.App.Ref/3.1.0] to /usr/local/dotnet/current/packs/Microsoft.NETCore.App.Ref/3.1.0
#22 12.21 Downloading targeting pack [Microsoft.WindowsDesktop.App.Ref/3.1.0]
#22 12.57 Extracting targeting pack [Microsoft.WindowsDesktop.App.Ref/3.1.0] to /usr/local/dotnet/current/packs/Microsoft.WindowsDesktop.App.Ref/3.1.0
#22 12.70 Downloading targeting pack [Microsoft.AspNetCore.App.Ref/3.1.10]
#22 13.04 Extracting targeting pack [Microsoft.AspNetCore.App.Ref/3.1.10] to /usr/local/dotnet/current/packs/Microsoft.AspNetCore.App.Ref/3.1.10
#22 13.22 Downloading targeting pack [Microsoft.NETCore.App.Ref/3.0.0]
#22 13.58 Extracting targeting pack [Microsoft.NETCore.App.Ref/3.0.0] to /usr/local/dotnet/current/packs/Microsoft.NETCore.App.Ref/3.0.0
#22 13.79 Downloading targeting pack [Microsoft.WindowsDesktop.App.Ref/3.0.0]
#22 14.15 Extracting targeting pack [Microsoft.WindowsDesktop.App.Ref/3.0.0] to /usr/local/dotnet/current/packs/Microsoft.WindowsDesktop.App.Ref/3.0.0
#22 14.30 Downloading targeting pack [Microsoft.AspNetCore.App.Ref/3.0.1]
#22 14.60 Extracting targeting pack [Microsoft.AspNetCore.App.Ref/3.0.1] to /usr/local/dotnet/current/packs/Microsoft.AspNetCore.App.Ref/3.0.1
#22 14.79 Downloading targeting pack [Microsoft.WindowsDesktop.App.Ref/9.0.0]
#22 15.17 Extracting targeting pack [Microsoft.WindowsDesktop.App.Ref/9.0.0] to /usr/local/dotnet/current/packs/Microsoft.WindowsDesktop.App.Ref/9.0.0
#22 DONE 15.8s

@github-actions github-actions bot added the L: dotnet:nuget NuGet packages via nuget or dotnet label Feb 20, 2025
@brettfo brettfo marked this pull request as ready for review February 20, 2025 18:55
@brettfo brettfo requested a review from a team as a code owner February 20, 2025 18:55
@randhircs randhircs merged commit ed6ee2f into main Feb 20, 2025
77 checks passed
@randhircs randhircs deleted the dev/brettfo/nuget-targeting-packs branch February 20, 2025 21:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
L: dotnet:nuget NuGet packages via nuget or dotnet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants