From 364c8b9e4806bf1510f4d43895714265a69570d7 Mon Sep 17 00:00:00 2001 From: Doug Bunting <6431421+dougbu@users.noreply.github.com> Date: Mon, 24 Aug 2020 15:28:06 -0700 Subject: [PATCH 1/3] [release/5.0] Correct baseline checks - mostly duplicates #25217 - update `BaselineGenerator` to produce baselines useful in 6.0 (too) - update Baseline.Designer.props using new generator (matching 3.1.7 release) - always suppress references expressed only in `*.nuspec` files - needed even in servicing builds - restore warning and errors about removed references (new for 5.0) - adjust exclusions to handle `@(_ProjectReferenceByAssemblyName)` removal nit: do not generate empty `` elements --- eng/Baseline.Designer.props | 100 ++++++++---------- eng/targets/ResolveReferences.targets | 22 +++- .../BaselineGenerator.csproj | 1 + eng/tools/BaselineGenerator/Program.cs | 47 ++++++-- .../Microsoft.AspNetCore.Components.csproj | 14 ++- 5 files changed, 113 insertions(+), 71 deletions(-) diff --git a/eng/Baseline.Designer.props b/eng/Baseline.Designer.props index c4f0bf31d397..d3894b52f088 100644 --- a/eng/Baseline.Designer.props +++ b/eng/Baseline.Designer.props @@ -8,12 +8,10 @@ 3.0.3 - 3.0.3 - 3.1.7 @@ -29,7 +27,7 @@ 3.1.7 - + @@ -48,7 +46,7 @@ 3.1.7 - + @@ -56,7 +54,7 @@ 3.1.7 - + @@ -64,53 +62,48 @@ 3.1.7 - 3.1.7 - 3.1.7 - 3.1.7 - + 3.1.7 - 3.1.7 - + 3.1.7 - + 3.1.7 - 3.1.7 - + @@ -118,7 +111,7 @@ 3.1.7 - + @@ -132,7 +125,7 @@ 3.1.7 - + @@ -147,7 +140,7 @@ 3.1.7 - + @@ -160,7 +153,7 @@ - + @@ -173,7 +166,7 @@ 3.1.7 - + @@ -185,7 +178,7 @@ 3.1.7 - + @@ -196,7 +189,7 @@ 3.1.7 - + @@ -230,7 +223,6 @@ 3.2.1 - 3.2.1 @@ -243,7 +235,6 @@ 3.2.1 - 3.2.1 @@ -255,7 +246,7 @@ 3.1.7 - + @@ -263,7 +254,7 @@ 3.1.7 - + @@ -280,8 +271,6 @@ 3.1.7 - - 3.1.7 @@ -289,7 +278,7 @@ - + @@ -299,7 +288,7 @@ 3.1.7 - + @@ -324,8 +313,6 @@ 3.1.7 - - 3.1.7 @@ -356,7 +343,7 @@ 3.1.7 - + @@ -376,14 +363,14 @@ 3.1.7 - + 3.1.7 - + @@ -391,7 +378,7 @@ 3.1.7 - + @@ -412,7 +399,7 @@ 3.1.7 - + @@ -423,7 +410,7 @@ 3.1.7 - + @@ -435,7 +422,7 @@ 3.1.7 - + @@ -447,7 +434,7 @@ 3.1.7 - + @@ -458,7 +445,7 @@ 3.1.7 - + @@ -475,20 +462,18 @@ 3.1.7 - - 3.1.7 - + 3.1.7 - + @@ -497,7 +482,7 @@ 3.1.7 - + @@ -506,7 +491,7 @@ 3.1.7 - + @@ -515,7 +500,7 @@ 3.1.7 - + @@ -523,12 +508,11 @@ 3.1.7 - 3.1.7 - + @@ -565,7 +549,7 @@ 3.1.7 - + @@ -578,7 +562,7 @@ 3.1.7 - + @@ -604,7 +588,7 @@ 3.1.7 - + @@ -616,7 +600,7 @@ 3.1.7 - + @@ -625,14 +609,14 @@ 3.1.7 - + 3.1.7 - + @@ -640,7 +624,7 @@ 3.1.7 - + @@ -684,7 +668,7 @@ 3.1.7 - + @@ -698,7 +682,7 @@ 3.1.7 - + diff --git a/eng/targets/ResolveReferences.targets b/eng/targets/ResolveReferences.targets index 646a526c8161..fe8224d1988d 100644 --- a/eng/targets/ResolveReferences.targets +++ b/eng/targets/ResolveReferences.targets @@ -175,9 +175,15 @@ - - + Exclude="@(Reference);@(PackageReference);@(ProjectReference->'%(Filename)')" /> + + + + + + + + + + Exe $(DefaultNetCoreTargetFramework) + --default-netcore-target-framework $(DefaultNetCoreTargetFramework) $(MSBuildThisFileDirectory)../../ diff --git a/eng/tools/BaselineGenerator/Program.cs b/eng/tools/BaselineGenerator/Program.cs index d125bfdf71e3..0271b3d80e03 100644 --- a/eng/tools/BaselineGenerator/Program.cs +++ b/eng/tools/BaselineGenerator/Program.cs @@ -30,13 +30,21 @@ static void Main(string[] args) new Program().Execute(args); } + private readonly CommandOption _defaultTarget; private readonly CommandOption _source; private readonly CommandOption _output; private readonly CommandOption _update; public Program() { - _source = Option("-s|--package-source ", "The NuGet source of packages to fetch", CommandOptionType.SingleValue); + _defaultTarget = Option( + "--default-netcore-target-framework ", + "The default .NET Core TFM.", + CommandOptionType.SingleValue); + _source = Option( + "-s|--package-source ", + "The NuGet source of packages to fetch", + CommandOptionType.SingleValue); _output = Option("-o|--output ", "The generated file output path", CommandOptionType.SingleValue); _update = Option("-u|--update", "Regenerate the input (Baseline.xml) file.", CommandOptionType.NoValue); @@ -45,17 +53,21 @@ public Program() private async Task Run() { - var source = _source.HasValue() - ? _source.Value().TrimEnd('/') - : "https://api.nuget.org/v3/index.json"; if (_output.HasValue() && _update.HasValue()) { await Error.WriteLineAsync("'--output' and '--update' options must not be used together."); return 1; } + if (!_defaultTarget.HasValue()) + { + await Error.WriteLineAsync("--default-netcore-target-framework is required."); + return 2; + } + var inputPath = Path.Combine(Directory.GetCurrentDirectory(), "Baseline.xml"); var input = XDocument.Load(inputPath); + var source = _source.HasValue() ? _source.Value().TrimEnd('/') : "https://api.nuget.org/v3/index.json"; var packageSource = new PackageSource(source); var providers = Repository.Provider.GetCoreV3(); // Get v2 and v3 API support var sourceRepository = new SourceRepository(packageSource, providers); @@ -96,6 +108,7 @@ private async Task Run() new XElement("MSBuildAllProjects", "$(MSBuildAllProjects);$(MSBuildThisFileFullPath)"), new XElement("AspNetCoreBaselineVersion", baselineVersion)))); + var defaultTarget = _defaultTarget.Value(); var client = new HttpClient(); foreach (var pkg in input.Root.Descendants("Package")) { @@ -136,12 +149,34 @@ private async Task Run() foreach (var group in reader.NuspecReader.GetDependencyGroups()) { - var itemGroup = new XElement("ItemGroup", new XAttribute("Condition", $" '$(PackageId)' == '{id}' AND '$(TargetFramework)' == '{group.TargetFramework.GetShortFolderName()}' ")); + // Don't bother generating empty ItemGroup elements. + if (group.Packages.Count() == 0) + { + continue; + } + + // Handle changes to $(DefaultNetCoreTargetFramework) even if some projects are held back. + var targetCondition = $"'$(TargetFramework)' == '{group.TargetFramework.GetShortFolderName()}'"; + if (string.Equals( + group.TargetFramework.GetShortFolderName(), + defaultTarget, + StringComparison.OrdinalIgnoreCase)) + { + targetCondition = + $"('$(TargetFramework)' == '$(DefaultNetCoreTargetFramework)' OR {targetCondition})"; + } + + var itemGroup = new XElement( + "ItemGroup", + new XAttribute("Condition", $" '$(PackageId)' == '{id}' AND {targetCondition} ")); doc.Root.Add(itemGroup); foreach (var dependency in group.Packages) { - itemGroup.Add(new XElement("BaselinePackageReference", new XAttribute("Include", dependency.Id), new XAttribute("Version", dependency.VersionRange.ToString()))); + itemGroup.Add( + new XElement("BaselinePackageReference", + new XAttribute("Include", dependency.Id), + new XAttribute("Version", dependency.VersionRange.ToString()))); } } } diff --git a/src/Components/Components/src/Microsoft.AspNetCore.Components.csproj b/src/Components/Components/src/Microsoft.AspNetCore.Components.csproj index 1e7f881ed501..110ed5f7ae81 100644 --- a/src/Components/Components/src/Microsoft.AspNetCore.Components.csproj +++ b/src/Components/Components/src/Microsoft.AspNetCore.Components.csproj @@ -17,11 +17,17 @@ - + - - - + + + From b695d8d02a4abb067041e256b946688407833ca2 Mon Sep 17 00:00:00 2001 From: Doug Bunting <6431421+dougbu@users.noreply.github.com> Date: Sat, 22 Aug 2020 12:40:20 -0700 Subject: [PATCH 2/3] Correct `@(SuppressBaselineReference)` items - remove out-of-date `@(SuppressBaselineReference)` items - either 3.1.7 baselines we're using don't include reference or still using package - fix some comments and `Condition` attributes to make remainder easy to find - add missing `@(SuppressBaselineReference)` items --- ...icrosoft.AspNetCore.Components.WebAssembly.csproj | 12 ++++++++---- .../src/Microsoft.AspNetCore.DataProtection.csproj | 1 - .../src/Microsoft.AspNetCore.TestHost.csproj | 5 +++++ .../src/Microsoft.AspNetCore.Http.Features.csproj | 5 +++++ .../src/Microsoft.Extensions.Identity.Stores.csproj | 1 - ...ft.AspNetCore.Identity.Specification.Tests.csproj | 4 ---- .../UI/src/Microsoft.AspNetCore.Identity.UI.csproj | 5 +++++ ...rosoft.AspNetCore.Connections.Abstractions.csproj | 8 ++++++++ .../Microsoft.AspNetCore.SignalR.Client.Core.csproj | 6 +++--- ...crosoft.AspNetCore.Http.Connections.Common.csproj | 8 -------- ...icrosoft.AspNetCore.SignalR.Protocols.Json.csproj | 5 ----- .../src/Microsoft.AspNetCore.SignalR.Common.csproj | 8 -------- .../dotnet-sql-cache/src/dotnet-sql-cache.csproj | 3 --- 13 files changed, 34 insertions(+), 37 deletions(-) diff --git a/src/Components/WebAssembly/WebAssembly/src/Microsoft.AspNetCore.Components.WebAssembly.csproj b/src/Components/WebAssembly/WebAssembly/src/Microsoft.AspNetCore.Components.WebAssembly.csproj index 906e03fe82e6..cf30c9c9e2e1 100644 --- a/src/Components/WebAssembly/WebAssembly/src/Microsoft.AspNetCore.Components.WebAssembly.csproj +++ b/src/Components/WebAssembly/WebAssembly/src/Microsoft.AspNetCore.Components.WebAssembly.csproj @@ -1,4 +1,4 @@ - + $(DefaultNetCoreTargetFramework) @@ -15,9 +15,13 @@ - - - + diff --git a/src/DataProtection/DataProtection/src/Microsoft.AspNetCore.DataProtection.csproj b/src/DataProtection/DataProtection/src/Microsoft.AspNetCore.DataProtection.csproj index 8a207fb49174..8f16e3348034 100644 --- a/src/DataProtection/DataProtection/src/Microsoft.AspNetCore.DataProtection.csproj +++ b/src/DataProtection/DataProtection/src/Microsoft.AspNetCore.DataProtection.csproj @@ -29,7 +29,6 @@ - diff --git a/src/Hosting/TestHost/src/Microsoft.AspNetCore.TestHost.csproj b/src/Hosting/TestHost/src/Microsoft.AspNetCore.TestHost.csproj index b4465d4958a7..45f833b2f3c3 100644 --- a/src/Hosting/TestHost/src/Microsoft.AspNetCore.TestHost.csproj +++ b/src/Hosting/TestHost/src/Microsoft.AspNetCore.TestHost.csproj @@ -13,4 +13,9 @@ + + + + + diff --git a/src/Http/Http.Features/src/Microsoft.AspNetCore.Http.Features.csproj b/src/Http/Http.Features/src/Microsoft.AspNetCore.Http.Features.csproj index aff4e11d9d2c..d6e93d7b0212 100644 --- a/src/Http/Http.Features/src/Microsoft.AspNetCore.Http.Features.csproj +++ b/src/Http/Http.Features/src/Microsoft.AspNetCore.Http.Features.csproj @@ -20,4 +20,9 @@ + + + + + diff --git a/src/Identity/Extensions.Stores/src/Microsoft.Extensions.Identity.Stores.csproj b/src/Identity/Extensions.Stores/src/Microsoft.Extensions.Identity.Stores.csproj index 380bf7818c8f..367a0069f14a 100644 --- a/src/Identity/Extensions.Stores/src/Microsoft.Extensions.Identity.Stores.csproj +++ b/src/Identity/Extensions.Stores/src/Microsoft.Extensions.Identity.Stores.csproj @@ -13,7 +13,6 @@ - diff --git a/src/Identity/Specification.Tests/src/Microsoft.AspNetCore.Identity.Specification.Tests.csproj b/src/Identity/Specification.Tests/src/Microsoft.AspNetCore.Identity.Specification.Tests.csproj index ab593d04a163..ba7e177bfbd0 100644 --- a/src/Identity/Specification.Tests/src/Microsoft.AspNetCore.Identity.Specification.Tests.csproj +++ b/src/Identity/Specification.Tests/src/Microsoft.AspNetCore.Identity.Specification.Tests.csproj @@ -20,8 +20,4 @@ - - - - diff --git a/src/Identity/UI/src/Microsoft.AspNetCore.Identity.UI.csproj b/src/Identity/UI/src/Microsoft.AspNetCore.Identity.UI.csproj index fb2f0d6eaae9..685ffe67b5f7 100644 --- a/src/Identity/UI/src/Microsoft.AspNetCore.Identity.UI.csproj +++ b/src/Identity/UI/src/Microsoft.AspNetCore.Identity.UI.csproj @@ -42,6 +42,11 @@ + + + + + diff --git a/src/Servers/Connections.Abstractions/src/Microsoft.AspNetCore.Connections.Abstractions.csproj b/src/Servers/Connections.Abstractions/src/Microsoft.AspNetCore.Connections.Abstractions.csproj index 943461e7f76a..b9614fcb0221 100644 --- a/src/Servers/Connections.Abstractions/src/Microsoft.AspNetCore.Connections.Abstractions.csproj +++ b/src/Servers/Connections.Abstractions/src/Microsoft.AspNetCore.Connections.Abstractions.csproj @@ -23,4 +23,12 @@ + + + + + diff --git a/src/SignalR/clients/csharp/Client.Core/src/Microsoft.AspNetCore.SignalR.Client.Core.csproj b/src/SignalR/clients/csharp/Client.Core/src/Microsoft.AspNetCore.SignalR.Client.Core.csproj index cc35aef6bdfb..504f2e454992 100644 --- a/src/SignalR/clients/csharp/Client.Core/src/Microsoft.AspNetCore.SignalR.Client.Core.csproj +++ b/src/SignalR/clients/csharp/Client.Core/src/Microsoft.AspNetCore.SignalR.Client.Core.csproj @@ -27,9 +27,9 @@ - - - + + + diff --git a/src/SignalR/common/Http.Connections.Common/src/Microsoft.AspNetCore.Http.Connections.Common.csproj b/src/SignalR/common/Http.Connections.Common/src/Microsoft.AspNetCore.Http.Connections.Common.csproj index 3ecebb0f5c48..02f97edfb68c 100644 --- a/src/SignalR/common/Http.Connections.Common/src/Microsoft.AspNetCore.Http.Connections.Common.csproj +++ b/src/SignalR/common/Http.Connections.Common/src/Microsoft.AspNetCore.Http.Connections.Common.csproj @@ -23,12 +23,4 @@ - - - - - - - - diff --git a/src/SignalR/common/Protocols.Json/src/Microsoft.AspNetCore.SignalR.Protocols.Json.csproj b/src/SignalR/common/Protocols.Json/src/Microsoft.AspNetCore.SignalR.Protocols.Json.csproj index afe8cf0816ef..cae05aae1122 100644 --- a/src/SignalR/common/Protocols.Json/src/Microsoft.AspNetCore.SignalR.Protocols.Json.csproj +++ b/src/SignalR/common/Protocols.Json/src/Microsoft.AspNetCore.SignalR.Protocols.Json.csproj @@ -23,9 +23,4 @@ - - - - - diff --git a/src/SignalR/common/SignalR.Common/src/Microsoft.AspNetCore.SignalR.Common.csproj b/src/SignalR/common/SignalR.Common/src/Microsoft.AspNetCore.SignalR.Common.csproj index 730549a8d9d6..1206aeed6833 100644 --- a/src/SignalR/common/SignalR.Common/src/Microsoft.AspNetCore.SignalR.Common.csproj +++ b/src/SignalR/common/SignalR.Common/src/Microsoft.AspNetCore.SignalR.Common.csproj @@ -33,14 +33,6 @@ - - - - - - - - diff --git a/src/Tools/dotnet-sql-cache/src/dotnet-sql-cache.csproj b/src/Tools/dotnet-sql-cache/src/dotnet-sql-cache.csproj index bedcf8c05199..24f2823009cf 100644 --- a/src/Tools/dotnet-sql-cache/src/dotnet-sql-cache.csproj +++ b/src/Tools/dotnet-sql-cache/src/dotnet-sql-cache.csproj @@ -15,9 +15,6 @@ - - - From cf454a9a0f42047d42540f317654834de5340005 Mon Sep 17 00:00:00 2001 From: Doug Bunting <6431421+dougbu@users.noreply.github.com> Date: Wed, 26 Aug 2020 16:28:39 -0700 Subject: [PATCH 3/3] Let's try this again - update `BaselineGenerator` to get it working in 5.0 for realz --- .../BaselineGenerator/BaselineGenerator.csproj | 1 - eng/tools/BaselineGenerator/Program.cs | 17 +++++------------ 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/eng/tools/BaselineGenerator/BaselineGenerator.csproj b/eng/tools/BaselineGenerator/BaselineGenerator.csproj index 2985edf90308..775e7523c847 100644 --- a/eng/tools/BaselineGenerator/BaselineGenerator.csproj +++ b/eng/tools/BaselineGenerator/BaselineGenerator.csproj @@ -3,7 +3,6 @@ Exe $(DefaultNetCoreTargetFramework) - --default-netcore-target-framework $(DefaultNetCoreTargetFramework) $(MSBuildThisFileDirectory)../../ diff --git a/eng/tools/BaselineGenerator/Program.cs b/eng/tools/BaselineGenerator/Program.cs index 0271b3d80e03..e77b35edeeeb 100644 --- a/eng/tools/BaselineGenerator/Program.cs +++ b/eng/tools/BaselineGenerator/Program.cs @@ -30,17 +30,12 @@ static void Main(string[] args) new Program().Execute(args); } - private readonly CommandOption _defaultTarget; private readonly CommandOption _source; private readonly CommandOption _output; private readonly CommandOption _update; public Program() { - _defaultTarget = Option( - "--default-netcore-target-framework ", - "The default .NET Core TFM.", - CommandOptionType.SingleValue); _source = Option( "-s|--package-source ", "The NuGet source of packages to fetch", @@ -59,12 +54,6 @@ private async Task Run() return 1; } - if (!_defaultTarget.HasValue()) - { - await Error.WriteLineAsync("--default-netcore-target-framework is required."); - return 2; - } - var inputPath = Path.Combine(Directory.GetCurrentDirectory(), "Baseline.xml"); var input = XDocument.Load(inputPath); var source = _source.HasValue() ? _source.Value().TrimEnd('/') : "https://api.nuget.org/v3/index.json"; @@ -101,6 +90,11 @@ private async Task Run() var baselineVersion = input.Root.Attribute("Version").Value; + // Baseline and .NET Core versions always align in non-preview releases. + var parsedVersion = Version.Parse(baselineVersion); + var defaultTarget = ((parsedVersion.Major < 5) ? "netcoreapp" : "net") + + $"{parsedVersion.Major}.{parsedVersion.Minor}"; + var doc = new XDocument( new XComment(" Auto generated. Do not edit manually, use eng/tools/BaselineGenerator/ to recreate. "), new XElement("Project", @@ -108,7 +102,6 @@ private async Task Run() new XElement("MSBuildAllProjects", "$(MSBuildAllProjects);$(MSBuildThisFileFullPath)"), new XElement("AspNetCoreBaselineVersion", baselineVersion)))); - var defaultTarget = _defaultTarget.Value(); var client = new HttpClient(); foreach (var pkg in input.Root.Descendants("Package")) {