Skip to content
This repository has been archived by the owner on Apr 16, 2020. It is now read-only.
Cameron Taggart edited this page Jan 7, 2018 · 12 revisions

Please see the readme first.

SourceLink version 2 is much different than version 1, but with the same goal. Please update to version 2. It is cross platform and much smaller thanks to the Portable PDB format.

Here is the General, Debugging, Options Dialog Box from Visual Studio 2017: image

Enable source server support

SourceLink v1 automates source indexing of Windows PDB files. It enables the source code repostiory to be the source server by updating the Windows PDB files with a source index of https links. Source indexing is done by modifying the Windows PDB file after a compile.

Enable source link support

SourceLink v2 helps enable source link support using the Portable PDB format. They are cross platform and several times smaller than Windows PDB files. The implementation and specification are open source. Source link support has documentation and is in the Portable PDB spec. The source link JSON file is built before the compile and the .NET compilers embeds it in the Portable PDB file. The compilers shipped with Visual Studio 2017 and with the DotNet SDKs support the /sourcelink option. Here is the relevant help from the C# compiler:

. "C:\Program Files\dotnet\sdk\1.0.0\Roslyn\RunCsc.cmd" /?

 /debug:{full|pdbonly|portable|embedded}
                               Specify debugging type ('full' is default,
                               'portable' is a cross-platform format,
                               'embedded' is a cross-platform format embedded into
                               the target .dll or .exe)
                               
 /embed                        Embed all source files in the PDB.
 
 /embed:<file list>            Embed specific files in the PDB
 
 /sourcelink:<file>            Source link info to embed into Portable PDB.

Documentation

  • Version 1 is documented on the SourceLink v1 page.
    • The covers SourceLink.Fake that has been downloaded over 140,000 times as of 2017-02.
    • It also covers SourceLink.exe, the other way that v1 was distributed via Chocolatey.
  • The Visual Studio page covers source linking support in Visual Studio.
  • For the history of SourceLink, take a look at Release Notes and Blog Posts.
  • Contributing covers how you can help.

SourceLink.Create.CommandLine

By default SourceLink.Create.CommandLine will try to process GitHub and BitBucket cloned repositories. You can specify a specific server type by setting the SourceLinkServerType MSBuild property like /p:SourceLinkServerType=GitHub, /p:SourceLinkServerType=BitBucket, /p:SourceLinkServerType=BitBucketServer or /p:SourceLinkServerType=GitLab.

You can control when it runs by setting the MSBuild property /p:SourceLinkCreate=true. That property is set to true by default on build servers that set CI or BUILD_NUMBER environment variables. In general these tools are meant to be run only on build servers.

Support

For support, please add an issue on GitHub or with the sourcelink tag on StackOverflow. If you want to tweet how much you love this project, please do mention @cmr0n.

Clone this wiki locally