From 76e8482e48bc8818b2d3d4c2be368b6b7bdcb246 Mon Sep 17 00:00:00 2001 From: Daniel Cazzulino Date: Fri, 1 Dec 2017 12:12:14 -0300 Subject: [PATCH] Fix failing test due to nuget package path casing The package cache lower cases all paths, which no longer matches the package id as we were previously doing. We need to match in a case- insensitive way therefore for private assets matching to succeed. This fixes a broken unit test that was blocking two PRs #151 and #150. Also, fix the nuget package versions at the time of this test authoring, so we don't accidentally break if newer packages ever change and cause the expectations to fail. --- .../NuGet.Build.Packaging.Inference.targets | 3 ++- .../given_a_library_with_private_assets_reference/a.csproj | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Build/NuGet.Build.Packaging.Tasks/NuGet.Build.Packaging.Inference.targets b/src/Build/NuGet.Build.Packaging.Tasks/NuGet.Build.Packaging.Inference.targets index 6764094..93a0668 100644 --- a/src/Build/NuGet.Build.Packaging.Tasks/NuGet.Build.Packaging.Inference.targets +++ b/src/Build/NuGet.Build.Packaging.Tasks/NuGet.Build.Packaging.Inference.targets @@ -178,6 +178,7 @@ Copyright (c) .NET Foundation. All rights reserved. <_PrivateAssets>@(_PrimaryPackageReference -> '%(PrivateAssets)') + <_ShouldIncludeAssetsRegex>$(_NuGetPackageId)\\.+\\$(_PrivateAssets)\\.* @@ -191,7 +192,7 @@ Copyright (c) .NET Foundation. All rights reserved. - <_InferredPackageFile Include="@(_PrimaryOutputRelatedFile)" Condition="$([System.Text.RegularExpressions.Regex]::IsMatch('%(_PrimaryOutputRelatedFile.FullPath)', '$(_NuGetPackageId)\\.+\\$(_PrivateAssets)\\.*')) == 'true'"> + <_InferredPackageFile Include="@(_PrimaryOutputRelatedFile)" Condition="$([System.Text.RegularExpressions.Regex]::IsMatch('%(_PrimaryOutputRelatedFile.FullPath)', '$(_ShouldIncludeAssetsRegex)', 'RegexOptions.IgnoreCase')) == 'true'"> $(PrimaryOutputKind) $(PrimaryOutputFrameworkSpecific) diff --git a/src/Build/NuGet.Build.Packaging.Tests/Scenarios/given_a_library_with_private_assets_reference/a.csproj b/src/Build/NuGet.Build.Packaging.Tests/Scenarios/given_a_library_with_private_assets_reference/a.csproj index 16a8b16..aed265d 100644 --- a/src/Build/NuGet.Build.Packaging.Tests/Scenarios/given_a_library_with_private_assets_reference/a.csproj +++ b/src/Build/NuGet.Build.Packaging.Tests/Scenarios/given_a_library_with_private_assets_reference/a.csproj @@ -6,15 +6,15 @@ - * + 5.3.0 all - * + 9.0.1 lib - * + 2.3.0