diff --git a/src/NuGet.Core/NuGet.Build.Tasks.Pack/Pack.targets b/src/NuGet.Core/NuGet.Build.Tasks.Pack/Pack.targets index e587c797c7..2e41bf4898 100644 --- a/src/NuGet.Core/NuGet.Build.Tasks.Pack/Pack.targets +++ b/src/NuGet.Core/NuGet.Build.Tasks.Pack/Pack.targets @@ -45,7 +45,7 @@ Copyright (c) .NET Foundation. All rights reserved. <_TargetFrameworks Condition="'$(TargetFramework)' == ''" Include="$(TargetFrameworks.Split(';'))"/> <_TargetFrameworks Condition="'$(TargetFramework)' != ''" Include="$(TargetFramework)"/> - + + <_ProjectReferences Include="$(MSBuildProjectFullPath)"> $(PackageId) $(PackageVersion) - $(IncludeAssets) - $(ExcludeAssets) - $(PrivateAssets) - $(TargetFramework) - Package - + @@ -236,21 +223,31 @@ Copyright (c) .NET Foundation. All rights reserved. + Targets="_GetProjectMetadata" + Properties="CustomAfterMicrosoftCommonTargets=$(MSBuildThisFileFullPath); + CustomAfterMicrosoftCommonCrossTargetingTargets=$(MSBuildThisFileFullPath); + BuildProjectReferences=false"> + ItemName="_ProjectReferencesWithoutParentData" /> + + + <_ProjectReferences Include="@(_ProjectReferencesWithoutParentData)"> + $(TargetFramework) + Package + + <_ProjectReferences Condition="'%(_ProjectReferences.IncludeAssets)' == ''"> + all + + <_ProjectReferences Condition="'%(_ProjectReferences.ExcludeAssets)' == ''"> + none + + <_ProjectReferences Condition="'%(_ProjectReferences.PrivateAssets)' == ''"> + build;contentFiles;analyzers + + + <_PackageFiles Include="@(Content)" Condition=" %(Content.Pack) != 'false' " /> <_PackageFiles Include="@(Compile)" Condition=" %(Compile.Pack) == 'true' " /> @@ -271,7 +268,7 @@ Copyright (c) .NET Foundation. All rights reserved. -