DEV Community

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

Collapse
 
mmuecke profile image
mmuecke

Hi
thanks a lot for this solution. I like it to structure my nuget solutions in projects.
Is there a way to include the xml doc files form the referenced projects into the nuget.
This would make IntelliSense possible for the nuget.

Collapse
 
mmuecke profile image
mmuecke • Edited

I manged to include *.xml and *.pdb files in the output folder into the nuget with this changes:

  <PropertyGroup>
    ...
    <TargetsForTfmSpecificBuildOutput>
      $(TargetsForTfmSpecificBuildOutput);CopyProjectReferencesToPackage
    </TargetsForTfmSpecificBuildOutput>
    <AllowedOutputExtensionsInPackageBuildOutputFolder>
      $(AllowedOutputExtensionsInPackageBuildOutputFolder);.xml
      $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb
    </AllowedOutputExtensionsInPackageBuildOutputFolder>
  </PropertyGroup>
Enter fullscreen mode Exit fullscreen mode
  <Target DependsOnTargets="ResolveReferences" Name="CopyProjectReferencesToPackage">
    <ItemGroup>
      <BuildOutputInPackage Include="@(ReferenceCopyLocalPaths-&gt;WithMetadataValue('ReferenceSourceTarget', 'ProjectReference'))" />
      <BuildOutputInPackage Include="@(ReferenceCopyLocalPaths->WithMetadataValue('ReferenceSourceTarget', 'ProjectReference')->Replace('.dll', '.xml'))" />
      <BuildOutputInPackage Include="@(ReferenceCopyLocalPaths->WithMetadataValue('ReferenceSourceTarget', 'ProjectReference')->Replace('.dll', '.pdb'))" />
    </ItemGroup>
  </Target>
Enter fullscreen mode Exit fullscreen mode