DEV Community

Discussion on: Include both Nuget Package References *and* project reference DLL using “dotnet pack” 📦

Collapse
 
aklaus profile image
Alex Klaus

Wanted to cross-reference a similar implementation on SO - stackoverflow.com/a/59893520/968003.

BTW, in order to bring XML-docs add BuildOnlySettings to "Target DependsOnTargets". It also will add PDBs to *.snupkg if you generate one.

So the final snippet looks like:

<PropertyGroup>
    <TargetsForTfmSpecificBuildOutput>$(TargetsForTfmSpecificBuildOutput);CopyProjectReferencesToPackage</TargetsForTfmSpecificBuildOutput>
</PropertyGroup>
<Target DependsOnTargets="BuildOnlySettings;ResolveReferences" Name="CopyProjectReferencesToPackage">
    <ItemGroup>
        <BuildOutputInPackage Include="@(ReferenceCopyLocalPaths-&gt;WithMetadataValue('ReferenceSourceTarget', 'ProjectReference'))" />
    </ItemGroup>
</Target>