I have the following structure in my solution:Proj1--> Proj2-->Newtonsoft.JSON
I am packing Proj1 as a nuget and I want it to contain both Proj2.dll and Newtonsoft.JSON
My Proj1 looks like this:
Project Sdk="Microsoft.NET.Sdk"><PropertyGroup><TargetFramework>net8.0</TargetFramework><ImplicitUsings>enable</ImplicitUsings><Nullable>enable</Nullable><GeneratePackageOnBuild>True</GeneratePackageOnBuild><Title>xxx</Title><Authors>xxx</Authors><Company>xxx</Company><TargetsForTfmSpecificBuildOutput>$(TargetsForTfmSpecificBuildOutput);CopyProjectReferencesToPackage</TargetsForTfmSpecificBuildOutput></PropertyGroup><ItemGroup><ProjectReference Include="..\Proj2\Proj2.csproj" PrivateAssets="All"><ReferenceOutputAssembly>true</ReferenceOutputAssembly><IncludeAssets>*.dll</IncludeAssets><Private>True</Private></ProjectReference><Target Name="CopyProjectReferencesToPackage" DependsOnTargets="BuildOnlySettings;ResolveReferences"><ItemGroup><!-- Filter out unnecessary files --><_ReferenceCopyLocalPaths Include="@(ReferenceCopyLocalPaths->WithMetadataValue('ReferenceSourceTarget', 'ProjectReference')->WithMetadataValue('PrivateAssets', 'All'))" /></ItemGroup><!-- Print batches for debug purposes --><Message Text="Batch for .nupkg: ReferenceCopyLocalPaths = @(_ReferenceCopyLocalPaths), ReferenceCopyLocalPaths.DestinationSubDirectory = %(_ReferenceCopyLocalPaths.DestinationSubDirectory) Filename = %(_ReferenceCopyLocalPaths.Filename) Extension = %(_ReferenceCopyLocalPaths.Extension)" Importance="High" Condition="'@(_ReferenceCopyLocalPaths)' != ''" /><ItemGroup><!-- Add file to package with consideration of sub folder. If empty, the root folder is chosen. --><BuildOutputInPackage Include="@(_ReferenceCopyLocalPaths)" TargetPath="%(_ReferenceCopyLocalPaths.DestinationSubDirectory)" /></ItemGroup></Target></Project>
My Proj2 looks like:
<Project Sdk="Microsoft.NET.Sdk"><PropertyGroup><TargetFramework>net8.0</TargetFramework><ImplicitUsings>enable</ImplicitUsings><Nullable>enable</Nullable></PropertyGroup><ItemGroup><PackageReference Include="Newtonsoft.Json" Version="13.0.3"><PrivateAssets>All</PrivateAssets></PackageReference></ItemGroup></Project>
However, my output .nupkg does not contain Newtonsoft.JSON, just Proj2.dll
What am I missing?