Skip to content

Making .NET open source accessible!

License

Notifications You must be signed in to change notification settings

tstewart65/GitLink

 
 

Repository files navigation

GitLink

Join the chat at https://gitter.im/GitTools/GitLink

License NuGet downloads Version Pre-release version Chocolatey count Chocolatey version

GitLink

GitLink let's users step through your code hosted on GitHub! Help make .NET open source projects more accessible by enabling this for your .NET projects, it's just a single additional step in your build. See the list of projects using GitLink.

Click here to lend your support to: GitLink and make a donation at pledgie.com !

--

Important note

GitLink was formerly named GitHubLink. By adding support to more Git hosting services the name seemed not covering the whole package. The old GitHubLink packages on NuGet and Chocolatey will no longer be updated or maintained.

--

GitLink makes symbol servers obsolete which saves you both time with uploading source files with symbols and the user no longer has to specify custom symbol servers (such as symbolsource.org).

Stepping through external source code

The advantage of GitLink is that it is fully customized for Git. It also works with GitHub or BitBucket urls so it does not require a local git repository to work. This makes it perfectly usable in continuous integration servers such as Continua CI.

Updating all the pdb files is very fast. A solution with over 85 projects will be handled in less than 30 seconds.

When using GitLink, the user no longer has to specify symbol servers. The only requirement is to ensure the check the Enable source server support option in Visual Studio as shown below:

Enabling source server support

Troubleshooting

Source Stepping isn't working

  • Visual Studio 2012 needs to run elevated in order to download the source server files

  • Specify a value for Visual Studio -> Options -> Debugging -> Symbols -> Cache Symbols in this directory

Enabling source server support

Source Stepping returns HTML

If your repository is private, you are likely seeing the logon HTML from your git host.

  • Log onto your git host in Internet Explorer
  • Purge your local symbol cache

Supported git providers

GitLink supports the following providers out of the box (will auto-detect based on the url):

Providers currently being worked on:

It is also possible to specify a custom url provider.

Using GitLink as command line tool

Using GitLink via the command line is very simple:

  1. Build the solution - in release mode with pdb files enabled
  2. Run the console application with the right command line parameters
  3. Include the PDB in your nuget package

See Oren Novotony's blog post for even more detail and examples on build integration.

Most simple usage

This is the most simple usage available starting from 2.2.0. It will automatically determine the url and commit based on a local .git directory.

GitLink.exe c:\source\catel

Running for the default branch

GitLink.exe c:\source\catel -u https://github.com/catel/catel 

This will use the default branch (which is in most cases master). You can find out the default branch by checking what branch is loaded by default on the GitHub page.

Running for a specific branch

GitLink.exe c:\source\catel -u https://github.com/catel/catel -b develop

This will use the develop branch.

Running for a specific branch and configuration

GitLink.exe c:\source\catel -u https://github.com/catel/catel -b develop -c debug

This will use the develop branch and the debug configuration.

Running for a specific solution only

Sometimes a repository contains more than 1 solution file. By default, all solutions will be processed. To only process a single solution file, use the -f option:

GitLink.exe c:\source\catel -u https://github.com/catel/catel -f Catel.sln

Ignoring projects

When specific projects should be ignored, use the -ignore option. This option accepts a comma separated list of projects to ignore:

GitLink.exe c:\source\catel -u https://github.com/catel/catel -f Catel.sln -ignore Catel.Core.WP80,Catel.MVVM.WP80

Running for a custom raw content URL

When working with a content proxy or an alternative git VCS system that supports direct HTTP access to specific file revisions use the -u parameter with the custom raw content root URL

GitLink.exe c:\source\catel -u https://raw.githubusercontent.com/catel/catel

The custom url will be used to fill in the following pattern {customUrl}/{revision}/{relativeFilePath} when generating the source mapping.

Getting help

When you need help about GitLink, use the following command line:

GitLink.exe -help

Logging to a file

When you need to log the information to a file, use the following command line:

GitLink.exe c:\source\catel -u https://github.com/catel/catel -b develop -l GitLinkLog.log

Using GitLink in code

GitLink is built with 2 usages in mind: command line and code reference. Though most people will use the command line version, it is possible to reference the executable and use the logic in code.

The command line implementation uses the same available API.

Creating a context

To link files to a Git project, a context must be created. The command line version does this by using the ArgumentParser class. It is also possible to create a context from scratch as shown in the example below:

var context = new GitLink.Context();
context.SolutionDirectory = @"c:\source\catel";
context.TargetUrl = "https://github.com/catel/catel";
context.TargetBranch = "develop";

It is possible to create a context based on command line arguments:

var context = ArgumentParser.Parse(@"c:\source\catel -u https://github.com/catel/catel -b develop");

Linking a context

Once a context is created, the Linker class can be used to actually link the files:

Linker.Link(context);

How to get

There are three general ways to get GitLink:

Get it from GitHub

The releases will be available as separate executable download on the releases tab of the project.

Get it via Chocolatey

If you want to install the tool on your (build) computer, the package is available via Chocolatey. To install, use the following command:

choco install gitlink

Get it via NuGet

If you want to reference the assembly to use it in code, the recommended way to get it is via NuGet.

Note that getting GitLink via NuGet will add it as a reference to the project

How does it work

The SrcSrv tool (Srcsrv.dll) enables a client to retrieve the exact version of the source files that were used to build an application. Because the source code for a module can change between versions and over the course of years, it is important to look at the source code as it existed when the version of the module in question was built.

For more information, see the official documentation of SrcSrv.

GitLink creates a source index file and updates the PDB file so it will retrieve the files from the Git host file handler.

Projects using GitLink

Below is a list of projects already using GitLink (alphabetically ordered).

Are you using GitLink in your projects? Let us know and we will add your project to the list.

Note that you can also create a pull request on this document and add it yourself.

Icon

Link by Dominic Whittle from The Noun Project

About

Making .NET open source accessible!

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 98.8%
  • Batchfile 1.2%