Skip to content

Commit ce73397

Browse files
committed
Update Readme to 8.0.0
1 parent c782a04 commit ce73397

File tree

1 file changed

+38
-32
lines changed

1 file changed

+38
-32
lines changed

README.md

Lines changed: 38 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,53 +2,55 @@
22

33
Source Link is a language- and source-control agnostic system for providing first-class source debugging experiences for binaries. The goal of the project is to enable anyone building [NuGet libraries to provide source debugging](https://github.com/dotnet/designs/blob/main/accepted/2020/diagnostics/debugging-with-symbols-and-sources.md) for their users with almost no effort. Microsoft libraries, such as .NET Core and Roslyn have enabled Source Link. Source Link is supported by Microsoft.
44

5-
Source Link is a [set of packages](https://www.nuget.org/packages?q=Microsoft.SourceLink) and a [specification](https://github.com/dotnet/designs/blob/main/accepted/2020/diagnostics/source-link.md#source-link-file-specification) for describing source control metadata that can be embedded in symbols, binaries and packages.
5+
Source Link [specification](https://github.com/dotnet/designs/blob/main/accepted/2020/diagnostics/source-link.md#source-link-file-specification) describes source control metadata that can be embedded in symbols, binaries and packages to link them to their original sources.
66

77
Visual Studio 15.3+ supports reading Source Link information from symbols while debugging. It downloads and displays the appropriate commit-specific source for users, such as from [raw.githubusercontent](https://raw.githubusercontent.com/dotnet/roslyn/681cbc414542ffb9fb13ded613d26a88ea73a44b/src/VisualStudio/Core/Def/Implementation/ProjectSystem/AbstractProject.cs), enabling breakpoints and all other sources debugging experience on arbitrary NuGet dependencies. Visual Studio 15.7+ supports downloading source files from private GitHub and Azure DevOps (former VSTS) repositories that require authentication.
88

99
The [original Source Link implementation](https://github.com/ctaggart/SourceLink) was provided by [@ctaggart](https://github.com/ctaggart). Thanks! The .NET Team and Cameron worked together to make this implementation available in the .NET Foundation.
1010

11-
> If you arrived here from the original Source Link documentation - you do not need to use `SourceLink.Create.CommandLine`. You only need to install the packages listed below.
11+
> If you arrived here from the original Source Link documentation - you do not need to use `SourceLink.Create.CommandLine`.
1212
13-
## <a name="using-sourcelink">Using Source Link in .NET projects
13+
## Using Source Link in .NET projects
1414

15-
You can enable Source Link experience in your own .NET project by setting a few properties and adding a PackageReference to a Source Link package:
15+
Starting with .NET 8, Source Link for the following source control providers is included in the .NET SDK and enabled by default:
16+
- [GitHub](http://github.com) or [GitHub Enterprise](https://enterprise.github.com/home)
17+
- [Azure Repos](https://azure.microsoft.com/en-us/services/devops/repos) git repositories (formerly known as Visual Studio Team Services)
18+
- [GitLab](https://gitlab.com) 12.0+ (for older versions see [GitLab settings](#gitlab))
19+
- [Bitbucket](https://bitbucket.org/) 4.7+ (for older versions see [Bitbucket settings](#bitbucket))
20+
21+
If your project uses .NET SDK 8+ and is hosted by the above providers it does not need to reference any Source Link packages or set any build properties.
22+
23+
**Otherwise**, you can enable Source Link experience in your project by setting a few properties and adding a PackageReference to a Source Link package specific to the provider:
1624

1725
```xml
18-
<Project Sdk="Microsoft.NET.Sdk">
26+
<Project>
1927
<PropertyGroup>
20-
<TargetFramework>netcoreapp2.1</TargetFramework>
21-
2228
<!-- Optional: Publish the repository URL in the built .nupkg (in the NuSpec <Repository> element) -->
2329
<PublishRepositoryUrl>true</PublishRepositoryUrl>
2430

2531
<!-- Optional: Embed source files that are not tracked by the source control manager in the PDB -->
2632
<EmbedUntrackedSources>true</EmbedUntrackedSources>
27-
28-
<!-- Optional: Build symbol package (.snupkg) to distribute the PDB containing Source Link -->
29-
<IncludeSymbols>true</IncludeSymbols>
30-
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
3133
</PropertyGroup>
3234
<ItemGroup>
3335
<!-- Add PackageReference specific for your source control provider (see below) -->
3436
</ItemGroup>
3537
</Project>
3638
```
3739

38-
If you distribute the library via a package published to [NuGet.org](http://nuget.org), it is recommended to build a [symbol package](https://docs.microsoft.com/en-us/nuget/create-packages/symbol-packages-snupkg) and publish it to [NuGet.org](http://nuget.org) as well. This will make the symbols available on [NuGet.org symbol server](https://docs.microsoft.com/en-us/nuget/create-packages/symbol-packages-snupkg#nugetorg-symbol-server), where the debugger can download it from when needed. Alternatively, you can [include the symbols in the main package](#alternative-pdb-distribution). However, doing so is not recommended as it increases the size of the package and thus restore time for projects that consume your package.
39-
40-
Source Link packages are currently available for the following source control providers.
40+
Source Link packages are currently available for the source control providers listed below.
4141

4242
> Source Link package is a development dependency, which means it is only used during build. It is therefore recommended to set `PrivateAssets` to `all` on the package reference. This prevents consuming projects of your nuget package from attempting to install Source Link.
4343
44+
> Referencing any Source Link package in a .NET SDK 8+ project suppresses Source Link that is included in the SDK.
45+
4446
### github.com and GitHub Enterprise
4547

4648
For projects hosted by [GitHub](http://github.com) or [GitHub Enterprise](https://enterprise.github.com/home) reference
4749
[Microsoft.SourceLink.GitHub](https://www.nuget.org/packages/Microsoft.SourceLink.GitHub) like so:
4850

4951
```xml
5052
<ItemGroup>
51-
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All"/>
53+
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All"/>
5254
</ItemGroup>
5355
```
5456

@@ -58,7 +60,7 @@ For projects hosted by [Azure Repos](https://azure.microsoft.com/en-us/services/
5860

5961
```xml
6062
<ItemGroup>
61-
<PackageReference Include="Microsoft.SourceLink.AzureRepos.Git" Version="1.1.1" PrivateAssets="All"/>
63+
<PackageReference Include="Microsoft.SourceLink.AzureRepos.Git" Version="8.0.0" PrivateAssets="All"/>
6264
</ItemGroup>
6365
```
6466

@@ -69,7 +71,7 @@ For projects hosted by on-prem [Azure DevOps Server](https://azure.microsoft.com
6971

7072
```xml
7173
<ItemGroup>
72-
<PackageReference Include="Microsoft.SourceLink.AzureDevOpsServer.Git" Version="1.1.1" PrivateAssets="All"/>
74+
<PackageReference Include="Microsoft.SourceLink.AzureDevOpsServer.Git" Version="8.0.0" PrivateAssets="All"/>
7375
</ItemGroup>
7476
```
7577

@@ -97,11 +99,11 @@ For projects hosted by [GitLab](https://gitlab.com) reference [Microsoft.SourceL
9799

98100
```xml
99101
<ItemGroup>
100-
<PackageReference Include="Microsoft.SourceLink.GitLab" Version="1.1.1" PrivateAssets="All"/>
102+
<PackageReference Include="Microsoft.SourceLink.GitLab" Version="8.0.0" PrivateAssets="All"/>
101103
</ItemGroup>
102104
```
103105

104-
Starting with version 1.1.1, Microsoft.SourceLink.GitLab assumes GitLab version 12.0+ by default.
106+
Starting with version 8.0.0, Microsoft.SourceLink.GitLab assumes GitLab version 12.0+ by default.
105107
If your project is hosted by GitLab older than version 12.0 you must specify `SourceLinkGitLabHost` item group in addition to the package reference:
106108

107109
```xml
@@ -121,7 +123,7 @@ For projects in git repositories hosted on [Bitbucket.org](https://bitbucket.org
121123

122124
```xml
123125
<ItemGroup>
124-
<PackageReference Include="Microsoft.SourceLink.Bitbucket.Git" Version="1.1.1" PrivateAssets="All"/>
126+
<PackageReference Include="Microsoft.SourceLink.Bitbucket.Git" Version="8.0.0" PrivateAssets="All"/>
125127
</ItemGroup>
126128
```
127129

@@ -142,7 +144,7 @@ For projects hosted on-prem via [gitweb](https://git-scm.com/docs/gitweb) refere
142144

143145
```xml
144146
<ItemGroup>
145-
<PackageReference Include="Microsoft.SourceLink.GitWeb" Version="1.1.1" PrivateAssets="All"/>
147+
<PackageReference Include="Microsoft.SourceLink.GitWeb" Version="8.0.0" PrivateAssets="All"/>
146148
</ItemGroup>
147149
```
148150

@@ -152,13 +154,13 @@ For projects hosted on-prem via [gitea](https://gitea.io) reference [Microsoft.S
152154

153155
```xml
154156
<ItemGroup>
155-
<PackageReference Include="Microsoft.SourceLink.Gitea" Version="1.1.1" PrivateAssets="All"/>
157+
<PackageReference Include="Microsoft.SourceLink.Gitea" Version="8.0.0" PrivateAssets="All"/>
156158
</ItemGroup>
157159
```
158160

159161
### Multiple providers, repositories with submodules
160162

161-
If your repository contains submodules hosted by other git providers reference packages of all these providers. For example, projects in a repository hosted by Azure Repos that links a GitHub repository via a submodule should reference both [Microsoft.SourceLink.AzureRepos.Git](https://www.nuget.org/packages/Microsoft.SourceLink.AzureRepos.Git) and [Microsoft.SourceLink.GitHub](https://www.nuget.org/packages/Microsoft.SourceLink.GitHub) packages. [Additional configuration](https://github.com/dotnet/sourcelink/blob/main/docs/README.md#configuring-projects-with-multiple-sourcelink-providers) might be needed if multiple Source Link packages are used in the project.
163+
If your repository contains submodules hosted by multiple git providers reference packages of all these providers, unless the project uses .NET SDK 8+ and submodules only use providers for which Source Link support is included. For example, projects in a repository hosted by Azure Repos that links a GitHub repository via a submodule should reference both [Microsoft.SourceLink.AzureRepos.Git](https://www.nuget.org/packages/Microsoft.SourceLink.AzureRepos.Git) and [Microsoft.SourceLink.GitHub](https://www.nuget.org/packages/Microsoft.SourceLink.GitHub) packages. [Additional configuration](https://github.com/dotnet/sourcelink/blob/main/docs/README.md#configuring-projects-with-multiple-sourcelink-providers) might be needed if multiple Source Link packages are used in the project.
162164

163165
## Using Source Link in C++ projects
164166

@@ -168,9 +170,9 @@ To add Source Link support to your native project add package references corresp
168170

169171
```xml
170172
<packages>
171-
<package id="Microsoft.Build.Tasks.Git" version="1.1.1" targetFramework="native" developmentDependency="true" />
172-
<package id="Microsoft.SourceLink.Common" version="1.1.1" targetFramework="native" developmentDependency="true" />
173-
<package id="Microsoft.SourceLink.GitHub" version="1.1.1" targetFramework="native" developmentDependency="true" />
173+
<package id="Microsoft.Build.Tasks.Git" version="8.0.0" targetFramework="native" developmentDependency="true" />
174+
<package id="Microsoft.SourceLink.Common" version="8.0.0" targetFramework="native" developmentDependency="true" />
175+
<package id="Microsoft.SourceLink.GitHub" version="8.0.0" targetFramework="native" developmentDependency="true" />
174176
</packages>
175177
```
176178

@@ -202,29 +204,33 @@ The VC++ linker supports `/SOURCELINK` [switch](https://docs.microsoft.com/en-us
202204
- Issue when building WPF projects with `/p:ContinuousIntegrationBuild=true`: https://github.com/dotnet/sourcelink/issues/91
203205
- Issue when building WPF projects with embedding sources on and `BaseIntermediateOutputPath` not a subdirectory of the project directory: https://github.com/dotnet/sourcelink/issues/492
204206

205-
## Alternative PDB distribution
207+
## PDB distributions
208+
209+
If you distribute the library via a package published to [NuGet.org](http://nuget.org), it is recommended to build a [symbol package](https://docs.microsoft.com/en-us/nuget/create-packages/symbol-packages-snupkg) and publish it to [NuGet.org](http://nuget.org) as well. This will make the symbols available on [NuGet.org symbol server](https://docs.microsoft.com/en-us/nuget/create-packages/symbol-packages-snupkg#nugetorg-symbol-server), where the debugger can download it from when needed.
206210

207-
Prior availability of [NuGet.org symbol server](https://docs.microsoft.com/en-us/nuget/create-packages/symbol-packages-snupkg#nugetorg-symbol-server) the recommendation used to be to include the PDB in the main NuGet package by setting the following property in your project:
211+
Alternatively, Portable PDBs can be included in the main NuGet package by setting the following property in your project:
208212

209213
```xml
210214
<PropertyGroup>
211215
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
212216
</PropertyGroup>
213217
```
214218

215-
Including PDBs in the .nupkg is generally no longer recommended as it increases the size of the package and thus restore time for projects that consume your package, regardless of whether the user needs to debug through the source code of your library or not. That said, .snupkg symbol packages have some limitations:
219+
Keep in mind that including PDBs in the .nupkg increases the size of the package and thus restore time for projects that consume your package, regardless of whether the user needs to debug through the source code of your library or not.
220+
221+
.snupkg symbol packages have following limitations:
216222

217-
- They do not currently support Windows PDBs (generated by VC++, or for managed projects that set build property `DebugType` to `full`)
223+
- They do not support Windows PDBs (generated by VC++, or for managed projects that set build property `DebugType` to `full`)
218224
- They require the library to be built by newer C#/VB compiler (Visual Studio 2017 Update 9).
219225
- The consumer of the package also needs Visual Studio 2017 Update 9 debugger.
220226
- Not supported by [Azure DevOps Artifacts](https://azure.microsoft.com/en-us/services/devops/artifacts) service.
221227

222-
Consider including PDBs in the main package only if it is not possible to use .snupkg for the above reasons.
228+
Consider including PDBs in the main package if it is not possible to use .snupkg for the above reasons.
223229
For managed projects, consider switching to Portable PDBs by setting `DebugType` property to `portable`. This is the default for .NET SDK projects, but not classic .NET projects.
224230

225231
## Builds
226232

227-
Pre-release builds are available from Azure DevOps public feed: `https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json` ([browse](https://dev.azure.com/dnceng/public/_packaging?_a=feed&feed=dotnet-tools)).
233+
Pre-release builds are available from Azure DevOps public feed: `https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet8/nuget/v3/index.json` ([browse](https://dev.azure.com/dnceng/public/_packaging?_a=feed&feed=dotnet8)).
228234

229235
[![Build Status](https://dnceng.visualstudio.com/public/_apis/build/status/SourceLink%20PR?branchName=main)](https://dnceng.visualstudio.com/public/_build/latest?definitionId=297?branchName=main)
230236

0 commit comments

Comments
 (0)