Making .NET open source accessible!
Перейти к файлу
Virgile Bello c22c256656 If specified, use user-provided SHA hash without opening the git repository (so that it can work without an actual git repository, i.e. with TeamCity agents) 2015-11-04 18:40:57 +09:00
deployment Updated chocolatey package 2014-12-01 17:04:26 +01:00
design/logo Added script to generate logos 2014-07-08 10:05:45 +02:00
doc #44 Added support for relative paths ($(MSBuildProjectDirectory)\..) for the solution directory 2014-11-09 16:11:10 +01:00
lib Renamed GitLink.Test to GitLink.Tests 2014-11-06 13:00:00 +01:00
src If specified, use user-provided SHA hash without opening the git repository (so that it can work without an actual git repository, i.e. with TeamCity agents) 2015-11-04 18:40:57 +09:00
tools/NuGet (-) Removed GitHubLink and GitVersion tools (located on build agents now) 2014-07-08 09:50:38 +02:00
.gitignore Added build scripts and updated NuGet packages 2014-12-02 10:05:33 +01:00
CONTRIBUTING.md #57 Added contributing 2015-06-01 20:18:46 +02:00
GitVersionConfig.yaml Updated GitVersion mode to ContinuousDeployment 2015-05-27 13:04:49 +02:00
LICENSE Updated copyright 2014-10-13 13:09:58 +02:00
README.md Updated Orc.* packages using GitLink 2015-10-26 09:42:51 +01:00
scripts - Build - Debug.bat Added build scripts and updated NuGet packages 2014-12-02 10:05:33 +01:00
scripts - Build - Release.bat Added build scripts and updated NuGet packages 2014-12-02 10:05:33 +01:00
scripts - Clean all.bat Added scripts for solution maintenance 2014-08-11 15:17:40 +02:00
scripts - Restore packages.bat Added scripts for solution maintenance 2014-08-11 15:17:40 +02:00

README.md

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. Note that the old GitHubLink packages on NuGet and Chocolatey will no long be updated / 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

This application is based on the SourceLink project. SourceLink requires FAKE to run and not everyone likes to write code in F#. GitLink is a wrapper around SourceLink specifically written to be easily used from any build system (locally or a build server) and in any .NET language. It also provides new features such as standard integration with GitHub and BitBucket and the possibility to use remote repositories. GitLink is available as console application and can be referenced as assembly to be used in other .NET assemblies.

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. He/she only has to enable the support for source servers in Visual Studio as shown in the image below:

Enabling source server support

Troubleshooting

Note that Visual Studio 2012 needs to run elevated in order to download the source server files due to a bug in Visual Studio 2012.

If the source stepping is not working, double check that Visual Studio has a valid symbol cache directory to store the source files being downloaded:

Enabling source server support

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 software (in release mode with pdb files enabled)
  2. Run the console application with the right command line parameters

Below are a few examples.

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

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