Skip to content

Instantly share code, notes, and snippets.

@bail16
Created January 11, 2019 08:36
Show Gist options
  • Save bail16/b0815e9d959aa960a8e4c7e015b70270 to your computer and use it in GitHub Desktop.
Save bail16/b0815e9d959aa960a8e4c7e015b70270 to your computer and use it in GitHub Desktop.
<Target Name="CopyPdbToPackage" Inputs="@(ReferenceCopyLocalPaths->WithMetadataValue('ReferenceSourceTarget', 'ProjectReference'))" Outputs="%(ProjectReference.Identity)"
AfterTargets="CopyProjectReferencesToPackage">
<PropertyGroup>
<CurrentReference>%(ProjectReference.Identity)</CurrentReference>
<CurrentReferenceName>$([System.IO.Path]::GetFileNameWithoutExtension($(CurrentReference)))</CurrentReferenceName>
</PropertyGroup>
<Message Text="Copying PDB of $(CurrentReferenceName) to packages..." Importance="high" Condition="'%(ProjectReference.NugetIgnore)'!='true'"/>
<ItemGroup>
<AllItems Include="@(ReferenceCopyLocalPaths->WithMetadataValue('OriginalProjectReferenceItemSpec', '$(CurrentReference)'))"/>
<PdbFiles Include="%(AllItems.Identity)" Condition="@(AllItems->EndsWith('.pdb'))=='true'" />
</ItemGroup>
<ItemGroup>
<TfmSpecificPackageFile Include="@(PdbFiles)" Condition="'%(ProjectReference.NugetIgnore)'!='true'">
<PackagePath>lib/$(TargetFramework)</PackagePath>
</TfmSpecificPackageFile>
</ItemGroup>
</Target>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment