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.
--
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).
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:
-
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
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
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 via the command line is very simple:
- Build the solution - in release mode with pdb files enabled
- Run the console application with the right command line parameters
- Include the PDB in your nuget package
See Oren Novotony's blog post for even more detail and examples on build integration.
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
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.
GitLink.exe c:\source\catel -u https://github.com/catel/catel -b develop
This will use the develop branch.
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.
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
When specific projects should be ignored, use the -ignore option. This option accepts a comma separated list of patterns to ignore. Each pattern is either a literal project name (case-insensitive) or a regex enclosed in slashes. For example:
GitLink.exe c:\source\catel -u https://github.com/catel/catel -f Catel.sln -ignore Catel.Core.WP80,Catel.MVVM.WP80
GitLink.exe c:\source\catel -u https://github.com/catel/catel -f Catel.sln -ignore /^.+\.WP80$/,Catel.Core
In case you want to ignore most of your projects, you can explicitly -include only the projects you need - others will be ignored automatically. Same as -ignore it accepts list of patterns. For example:
GitLink.exe c:\source\catel -u https://github.com/catel/catel -f Catel.sln -include Catel.Core
GitLink.exe c:\source\catel -u https://github.com/catel/catel -f Catel.sln -include /Catel\..*$/,SomeOtherProject
Finally, you can set both -ignore and -include options. In this case only projects matching one of -include patterns will be taken, but if and only if they don't match one of -ignores. For example, the following command line will include only Catel.* projects, except "Catel.Core":
GitLink.exe c:\source\catel -u https://github.com/catel/catel -f Catel.sln -include /Catel\..*$/ -ignore Catel.Core
When working with a repository using uncommon URL you can use placeholders to specifiy where the filename and revision hash should be, use -u
parameter with the custom URL
GitLink.exe c:\source\catel -u "https://host/projects/catel/repos/catel/browse/{filename}?at={revision}&raw"
The custom url will be used to fill the placeholders with the relative file path and the revision hash.
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.
When you need help about GitLink, use the following command line:
GitLink.exe -help
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
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.
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(new ProviderManager());
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");
Once a context is created, the Linker class can be used to actually link the files:
Linker.Link(context);
There are three general ways to get GitLink:
The releases will be available as separate executable download on the releases tab of the project.
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
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
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.
Below is a list of projects already using GitLink (alphabetically ordered).
- Catel
- eXpand
- Fluent.Ribbon
- GitLink
- MahApps.Metro
- NBitcoin
- NBitcoin.Indexer
- NEST and Elasticsearch.NET
- Orc.Analytics
- Orc.AutomaticSupport
- Orc.CommandLine
- Orc.Controls
- Orc.CrashReporting
- Orc.CsvHelper
- Orc.Feedback
- Orc.FileAssociation
- Orc.FilterBuilder
- Orc.LicenseManager
- Orc.Metadata
- Orc.Notifications
- Orc.NuGetExplorer
- Orc.ProjectManagement
- Orc.Search
- Orc.Sort
- Orc.Squirrel
- Orc.SupportPackage
- Orc.SystemInfo
- Orc.WorkspaceManagement
- Orc.Wizard
- Orchestra
- OxyPlot
- QBitNinja
- ReactiveUI
- Romantic Web
- xUnit.net
- xUnit.net Visual Studio Runner
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.
Link by Dominic Whittle from The Noun Project