Один из обходных путей - пометить любые активы, которые вы не хотите включать, как <PrivateAssets>all</PrivateAssets>
, а затем включить приведенный ниже код в файл проекта.
См. https://github.com/nuget/home/issues/3891#issuecomment-459848847 для получения дополнительной информации
<ItemGroup>
<ProjectReference Include="..\ClassLibrary1\ClassLibrary1.csproj">
<PrivateAssets>all</PrivateAssets>
</ProjectReference>
</ItemGroup>
<!--
The following solves the problem that 'dotnet pack' does not include the DLLs from referenced projects.
See https://github.com/NuGet/Home/issues/3891 for a description of the problem
and for newer versions / workarounds / built-in methods.
-->
<PropertyGroup>
<TargetsForTfmSpecificBuildOutput>$(TargetsForTfmSpecificBuildOutput);CopyProjectReferencesToPackage</TargetsForTfmSpecificBuildOutput>
<!-- include PDBs in the NuGet package -->
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
</PropertyGroup>
<Target Name="CopyProjectReferencesToPackage" DependsOnTargets="ResolveReferences">
<ItemGroup>
<BuildOutputInPackage Include="@(ReferenceCopyLocalPaths->WithMetadataValue('ReferenceSourceTarget', 'ProjectReference')->WithMetadataValue('PrivateAssets', 'all'))" />
</ItemGroup>
</Target>