Skip to content
This repository has been archived by the owner on Apr 16, 2020. It is now read-only.

New project system does not copy PDBs from packages when targeting .NET Framework #313

Closed
ctaggart opened this issue Feb 1, 2018 · 4 comments

Comments

@ctaggart
Copy link
Owner

ctaggart commented Feb 1, 2018

The bug is here dotnet/sdk#1458. This should be added to the Known Issues in the readme. It prevents source linking from working for apps targeting .NET Framework when using the net .NET Core project system.

I logged more info here:

There is a workaround by @jnm2 which involves adding this to your project file:

  <!-- https://github.com/dotnet/sdk/issues/1458 -->
  <PropertyGroup>
    <AllowedReferenceRelatedFileExtensions>.pdb</AllowedReferenceRelatedFileExtensions>
  </PropertyGroup>
  <Target Name="AddReferenceRelatedPathsToCopyLocal" AfterTargets="ResolveAssemblyReferences">
    <ItemGroup>
      <ReferenceCopyLocalPaths Include="@(_ReferenceRelatedPaths)" />
    </ItemGroup>
  </Target>
@ctaggart ctaggart changed the title .NET Core projects do not copy PDBs from packages when targeting .NET Framework New project system does not copy PDBs from packages when targeting .NET Framework Feb 2, 2018
@ctaggart
Copy link
Owner Author

ctaggart commented Jun 8, 2018

The work-a-round was published as SourceLink.Copy.PdbFiles in February. Simply add it to your project for the work-a-round.

@ctaggart ctaggart closed this as completed Jun 8, 2018
@kukjevov
Copy link
Contributor

I know this is closed, but SourceLink.Copy.PdbFiles does not work anymore with SDK 2.1.300. New workaround is required see below.

<Target Name="_ResolveCopyLocalNuGetPackagePdbs" Condition="$(CopyLocalLockFileAssemblies) == true" AfterTargets="ResolveReferences">
        <ItemGroup>
            <ReferenceCopyLocalPaths Include="@(ReferenceCopyLocalPaths->'%(RootDir)%(Directory)%(Filename).pdb')" Condition="'%(ReferenceCopyLocalPaths.NuGetPackageId)' != '' and Exists('%(RootDir)%(Directory)%(Filename).pdb')" />
        </ItemGroup>
    </Target>

@ctaggart
Copy link
Owner Author

Thanks @kukjevov. Happy to take a pull request.

@ctaggart ctaggart reopened this Jun 20, 2018
@ctaggart
Copy link
Owner Author

Fixed by @kukjevov in #352. SourceLink.Copy.PdbFiles has the update in 2.8.3:

<Project>
  <ItemGroup>
    <PackageReference Include="SourceLink.Copy.PdbFiles" Version="2.8.3" PrivateAssets="All" /> 
  </ItemGroup>
</Project>

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants