3

Is there a way to enable Source Linking with Nuget packages that are published with Release configuration?

We configured a local nuget server in which we store our framework dlls that are built with Release configurations. Client applications reference these dlls and we want to debug the framework from them.

I could make it work with packing the framework code with Debug configuration but in Release mode, the .pdb files are not loaded and I can confirm it on Modules Window in VS 2017.

Here is my configuration for source linking:

<Project>     
  <ItemGroup>
    <PackageReference Include="SourceLink.Embed.AllSourceFiles" Version="2.8.1" PrivateAssets="all" />
  </ItemGroup>
</Project>

Edit: I use Visual Studio 2017 version 15.7.3. I target .NET Core 2.1. I confirmed that pdb files are embedded into nupkg files and they are in the same directory with the dlls. Debug mode just works though.

yakya
  • 4,559
  • 2
  • 29
  • 31

1 Answers1

3

Yes, Release configuration works just fine with source linking or embedded source files. SourceLink.Embed.AllSourceFiles is not technically source linking, but is supported by my SourceLink tools. You are embedding the source code in the pdb files. Why aren't the pdb files loaded? Are they next to the .dll files? Are you running into https://github.com/ctaggart/SourceLink/issues/313 were the .pdb files are not copied when targeting the .NET Framework from the new project system? If so, there is an easy work-a-round. It would be helpful if you posted the version of Visual Studio, the version of .NET being used, and whether you are targeting .NET Framework or Core.

Cameron Taggart
  • 5,771
  • 4
  • 45
  • 70
  • Can you test the pdb files with `dotnet sourcelink` https://github.com/ctaggart/sourcelink/#test ? When debugging in Visual Studio, make sure those pdb ("symobols") are loaded. – Cameron Taggart Jun 10 '18 at 23:54
  • 1
    I already checked Test command and it's working fine with Release builds too. I will do some more research about loading pdb files with Release builds.. – yakya Jun 11 '18 at 12:53