Skip to content

Commit

Permalink
Update to latest client SDK to bring .NET 7 support onto the framewor…
Browse files Browse the repository at this point in the history
…ks tab (#9312)

* Add .NET 7 TFMs
* Update to latest NuGet SDK and System.Data.SqlClient to resolve CG alerts

I had to modify the TFM resolution code to resolve an Obsolete warning. Existing UT coverage is good and they all passed.

Resolve #9313
  • Loading branch information
joelverhagen authored Nov 16, 2022
1 parent f472850 commit d68cd0c
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="NuGet.Build.Tasks.Pack">
<Version>6.0.0</Version>
<Version>6.4.0</Version>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
14 changes: 5 additions & 9 deletions src/NuGet.Services.Entities/NuGet.Services.Entities.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,11 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="EntityFramework">
<Version>6.4.0-preview3-19553-01</Version>
</PackageReference>
<PackageReference Include="Newtonsoft.Json">
<Version>13.0.1</Version>
</PackageReference>
<PackageReference Include="NuGet.Frameworks">
<Version>6.0.0</Version>
</PackageReference>
<PackageReference Include="EntityFramework" Version="6.4.0-preview3-19553-01" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="NuGet.Frameworks" Version="6.4.0" />
<!-- This was lifted to a top-level dependency to resolve a Component Governance alert. -->
<PackageReference Include="System.Data.SqlClient" Version="4.8.5" />
</ItemGroup>

<ItemGroup>
Expand Down
11 changes: 10 additions & 1 deletion src/NuGetGallery.Core/Frameworks/SupportedFrameworks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ public static class SupportedFrameworks
public static readonly NuGetFramework Net60Tizen = new NuGetFramework(FrameworkIdentifiers.NetCoreApp, Version6, "tizen", EmptyVersion);
public static readonly NuGetFramework Net60TvOs = new NuGetFramework(FrameworkIdentifiers.NetCoreApp, Version6, "tvos", EmptyVersion);
public static readonly NuGetFramework Net60Windows = new NuGetFramework(FrameworkIdentifiers.NetCoreApp, Version6, "windows", EmptyVersion);
public static readonly NuGetFramework Net70Android = new NuGetFramework(FrameworkIdentifiers.NetCoreApp, Version7, "android", EmptyVersion);
public static readonly NuGetFramework Net70Ios = new NuGetFramework(FrameworkIdentifiers.NetCoreApp, Version7, "ios", EmptyVersion);
public static readonly NuGetFramework Net70MacOs = new NuGetFramework(FrameworkIdentifiers.NetCoreApp, Version7, "macos", EmptyVersion);
public static readonly NuGetFramework Net70MacCatalyst = new NuGetFramework(FrameworkIdentifiers.NetCoreApp, Version7, "maccatalyst", EmptyVersion);
public static readonly NuGetFramework Net70Tizen = new NuGetFramework(FrameworkIdentifiers.NetCoreApp, Version7, "tizen", EmptyVersion);
public static readonly NuGetFramework Net70TvOs = new NuGetFramework(FrameworkIdentifiers.NetCoreApp, Version7, "tvos", EmptyVersion);
public static readonly NuGetFramework Net70Windows = new NuGetFramework(FrameworkIdentifiers.NetCoreApp, Version7, "windows", EmptyVersion);
public static readonly NuGetFramework NetCore = new NuGetFramework(FrameworkIdentifiers.NetCore, EmptyVersion);
public static readonly NuGetFramework NetMf = new NuGetFramework(FrameworkIdentifiers.NetMicro, EmptyVersion);
public static readonly NuGetFramework UAP = new NuGetFramework(FrameworkIdentifiers.UAP, EmptyVersion);
Expand All @@ -51,7 +58,9 @@ static SupportedFrameworks()
MonoAndroid, MonoMac, MonoTouch,
Native,
Net11, Net2, Net35, Net4, Net403, Net45, Net451, Net452, Net46, Net461, Net462, Net463, Net47, Net471, Net472, Net48,
Net50, Net50Windows, Net60, Net60Android, Net60Ios, Net60MacCatalyst, Net60MacOs, Net60TvOs, Net60Windows,
Net50, Net50Windows,
Net60, Net60Android, Net60Ios, Net60MacCatalyst, Net60MacOs, Net60TvOs, Net60Windows,
Net70, Net70Android, Net70Ios, Net70MacCatalyst, Net70MacOs, Net70TvOs, Net70Windows,
NetCore, NetCore45, NetCore451,
NetCoreApp10, NetCoreApp11, NetCoreApp20, NetCoreApp21, NetCoreApp22, NetCoreApp30, NetCoreApp31,
NetMf,
Expand Down
2 changes: 1 addition & 1 deletion src/NuGetGallery.Core/NuGetGallery.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<Version>5.2.6</Version>
</PackageReference>
<PackageReference Include="NuGet.Packaging">
<Version>6.0.0</Version>
<Version>6.4.0</Version>
</PackageReference>
<PackageReference Include="NuGet.Services.FeatureFlags">
<Version>2.106.0</Version>
Expand Down
27 changes: 19 additions & 8 deletions src/NuGetGallery.Core/Services/AssetFrameworkHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ public static IEnumerable<NuGetFramework> GetAssetFrameworks(string packageId, I
var conventions = new ManagedCodeConventions(runtimeGraph);

// Let's test for tools packages first--they're a special case
var groups = Enumerable.Empty<ContentItemGroup>();
var groups = new List<ContentItemGroup>();
if (packageTypes.Count == 1 && (packageTypes[0] == PackageType.DotnetTool ||
packageTypes[0] == PackageType.DotnetCliTool))
{
// Only a package that is a tool package (and nothing else) will be matched against tools pattern set
groups = items.FindItemGroups(conventions.Patterns.ToolsAssemblies);
items.PopulateItemGroups(conventions.Patterns.ToolsAssemblies, groups);
}
else
{
Expand All @@ -67,14 +67,25 @@ public static IEnumerable<NuGetFramework> GetAssetFrameworks(string packageId, I
};

// We'll create a set of "groups" --these are content items which satisfy file pattern sets
var standardGroups = patterns
.SelectMany(p => items.FindItemGroups(p));
foreach (var pattern in patterns)
{
items.PopulateItemGroups(pattern, groups);
}

// Filter out MSBuild assets that don't match the package ID and append to groups we already have
var msbuildGroups = msbuildPatterns
.SelectMany(p => items.FindItemGroups(p))
.Where(g => HasBuildItemsForPackageId(g.Items, packageId));
groups = standardGroups.Concat(msbuildGroups);
var msbuildGroups = new List<ContentItemGroup>();
foreach (var pattern in msbuildPatterns)
{
items.PopulateItemGroups(pattern, msbuildGroups);
}

foreach (var group in msbuildGroups)
{
if (HasBuildItemsForPackageId(group.Items, packageId))
{
groups.Add(group);
}
}
}

// Now that we have a collection of groups which have made it through the pattern set filter, let's transform them into TFMs
Expand Down
2 changes: 1 addition & 1 deletion src/NuGetGallery.Services/NuGetGallery.Services.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
<Version>4.2.2</Version>
</PackageReference>
<PackageReference Include="NuGet.Protocol">
<Version>6.0.0</Version>
<Version>6.4.0</Version>
</PackageReference>
<PackageReference Include="NuGet.Services.Configuration">
<Version>2.106.0</Version>
Expand Down
10 changes: 9 additions & 1 deletion src/NuGetGallery/Web.config
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,14 @@
</system.diagnostics>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="NuGet.Versioning" publicKeyToken="31BF3856AD364E35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-6.4.0.123" newVersion="6.4.0.123"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="NuGet.Packaging" publicKeyToken="31BF3856AD364E35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-6.4.0.123" newVersion="6.4.0.123"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.IdentityModel.Tokens" publicKeyToken="31BF3856AD364E35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-6.7.1.0" newVersion="6.7.1.0"/>
Expand Down Expand Up @@ -674,4 +682,4 @@
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
</configuration>

0 comments on commit d68cd0c

Please sign in to comment.