diff --git a/src/NuGetizer.Tasks/NuGetizer.Inference.targets b/src/NuGetizer.Tasks/NuGetizer.Inference.targets index fa20d07e..20d2546d 100644 --- a/src/NuGetizer.Tasks/NuGetizer.Inference.targets +++ b/src/NuGetizer.Tasks/NuGetizer.Inference.targets @@ -574,6 +574,14 @@ Copyright (c) .NET Foundation. All rights reserved. $(_AllProjectCapabilities.Contains('WinRTReferences')) or $(_AllProjectCapabilities.Contains('SDKReferences'))">true + + true + ResolveReferences; _UpdatePackageReferenceVersions; diff --git a/src/NuGetizer.Tests/Scenarios/given_transitive_projects/Project1.csproj b/src/NuGetizer.Tests/Scenarios/given_transitive_projects/Project1.csproj new file mode 100644 index 00000000..b762ef76 --- /dev/null +++ b/src/NuGetizer.Tests/Scenarios/given_transitive_projects/Project1.csproj @@ -0,0 +1,15 @@ + + + + + net8.0 + enable + enable + Foo + + + + + + + diff --git a/src/NuGetizer.Tests/Scenarios/given_transitive_projects/Project2.csproj b/src/NuGetizer.Tests/Scenarios/given_transitive_projects/Project2.csproj new file mode 100644 index 00000000..41402a73 --- /dev/null +++ b/src/NuGetizer.Tests/Scenarios/given_transitive_projects/Project2.csproj @@ -0,0 +1,15 @@ + + + + + net8.0 + enable + enable + false + + + + + + + diff --git a/src/NuGetizer.Tests/Scenarios/given_transitive_projects/Project3.csproj b/src/NuGetizer.Tests/Scenarios/given_transitive_projects/Project3.csproj new file mode 100644 index 00000000..8cd2d12e --- /dev/null +++ b/src/NuGetizer.Tests/Scenarios/given_transitive_projects/Project3.csproj @@ -0,0 +1,15 @@ + + + + + net8.0 + enable + enable + false + + + + + + + diff --git a/src/NuGetizer.Tests/given_transitive_projects.cs b/src/NuGetizer.Tests/given_transitive_projects.cs new file mode 100644 index 00000000..9f9d0b92 --- /dev/null +++ b/src/NuGetizer.Tests/given_transitive_projects.cs @@ -0,0 +1,53 @@ +using Xunit; +using Xunit.Abstractions; + +namespace NuGetizer +{ + public class given_transitive_projects + { + readonly ITestOutputHelper output; + + public given_transitive_projects(ITestOutputHelper output) + { + this.output = output; + using var disable = OpenBuildLogAttribute.Disable(); + + Builder.BuildScenario(nameof(given_transitive_projects), target: "Restore", projectName: "Project1") + .AssertSuccess(output); + + Builder.BuildScenario(nameof(given_transitive_projects), target: "Build", projectName: "Project1") + .AssertSuccess(output); + } + + [Fact] + public void when_pack_no_build_then_succeeds() + { + var result = Builder.BuildScenario(nameof(given_transitive_projects), + projectName: "Project1", + // These are the properties passed by dotnet pack --no-build + properties: new { NoBuild = "true", _IsPacking = "true" }, + target: "GetPackageContents,Pack"); + + result.AssertSuccess(output); + + Assert.True(result.BuildResult.HasResultsForTarget("GetPackageContents")); + + var items = result.BuildResult.ResultsByTarget["GetPackageContents"]; + + Assert.Contains(items.Items, item => item.Matches(new + { + PackagePath = "lib/net8.0/Project1.dll" + })); + + Assert.Contains(items.Items, item => item.Matches(new + { + PackagePath = "lib/net8.0/Project2.dll" + })); + + Assert.Contains(items.Items, item => item.Matches(new + { + PackagePath = "lib/net8.0/Project3.dll" + })); + } + } +}