Skip to content

SourceLink

Maria Furman edited this page Apr 19, 2018 · 3 revisions

What is SourceLink?

SourceLink allows source code to be downloaded on demand when debugging.

How do I use it?

As of Wilson 5.2.2, SourceLink is enabled in our release builds. We have confirmed that it works properly with Visual Studio 2017, but according to the SourceLink documentation it is also supported by Visual Studio Code, JetBrains dotPeek, and JetBrains ReSharper.

If you're interested in including SourceLink in your own project, the simplest way is to include this nuget PackageReference in every project that you want SourceLink enabled for:

<Project>

    <ItemGroup>

        <PackageReference Include="SourceLink.Create.CommandLine" Version="2.8.0" PrivateAssets="All" /> 

    </ItemGroup>

</Project>

Then, at build time, simply make sure that the property /p:SourceLinkCreate=true is set. This will embed a JSON configuration file that contains information about the original source code in the PDB, allowing Visual Studio (and other debuggers) to retrieve it from GitHub or other hosted services. More information on using SourceLink can be found in the official SourceLink documentation provided in the Additional References section at the bottom of this page.

How do I know SourceLink is working?

If you're using a library that has SourceLink enabled and you don't already have access to the original source files, you will see the following prompt if, for example, an exception is thrown:

Clone this wiki locally