Skip to content

Commit

Permalink
Enable SourceLink (#68)
Browse files Browse the repository at this point in the history
This PR enables the SourceLink, which embeds PDB symbols that links to GitHub in the NuGet package so that the binaries can be debugged.

Fixed #66.
  • Loading branch information
jackliums authored Sep 27, 2018
1 parent 2f9cd0d commit 239cf15
Show file tree
Hide file tree
Showing 17 changed files with 46 additions and 16 deletions.
4 changes: 0 additions & 4 deletions build/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ steps:
inputs:
command: pack
configuration: '$(buildConfiguration)'
projects: |
**/*.csproj
!**/*UnitTest*.csproj
!**/*Integration.csproj
packDirectory: '$(build.artifactStagingDirectory)/nupkgs'
versioningScheme: 'byEnvVar'
versionEnvVar: 'nuget_version'
Expand Down
18 changes: 18 additions & 0 deletions docs/HowToDebug.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# How to debug

The projects are built with [Source Link](https://github.com/dotnet/sourcelink) enabled and are configured to include PDB files within the NuGet packages themselves. This allows source code files to be downloaded from our GitHub repo directly during debugging process.

## Enable debugging in Visual Studio

To enable debugging in Visual Studio, you need to:

![Debugging Options](images/HowToDebug/DebuggingOptions.png)

1. Uncheck "Enable Just My Code".
2. Check "Enable Source Link support.

When debugging into the code, Visual Studio will ask to download source code from GitHub.

![Download Source](images/HowToDebug/DownloadSource.png)

Click "Download Source and Continue Debugging" to continue.
Binary file added docs/images/HowToDebug/DebuggingOptions.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/HowToDebug/DownloadSource.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>

<IsPackable>false</IsPackable>
<CodeAnalysisRuleSet>..\..\CustomAnalysisRules.Test.ruleset</CodeAnalysisRuleSet>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
<DebugType>Full</DebugType>
<LangVersion>latest</LangVersion>
<HighEntropyVA>true</HighEntropyVA>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
</PropertyGroup>

<ItemGroup>
Expand All @@ -18,6 +21,7 @@
<PackageReference Include="Ensure.That" Version="8.0.0" />
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.6.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="2.1.0" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta-63127-02" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.0-beta006" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>

<IsPackable>false</IsPackable>
<CodeAnalysisRuleSet>..\..\CustomAnalysisRules.Test.ruleset</CodeAnalysisRuleSet>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
<DebugType>Full</DebugType>
<LangVersion>latest</LangVersion>
<HighEntropyVA>true</HighEntropyVA>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
</PropertyGroup>

<ItemGroup>
Expand All @@ -35,6 +38,7 @@
<PackageReference Include="Microsoft.CodeCoverage" Version="1.0.3" />
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="2.1.0" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="2.1.0" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta-63127-02" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.0-beta008" />
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="2.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.1.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>

<IsPackable>false</IsPackable>
<CodeAnalysisRuleSet>..\..\CustomAnalysisRules.Test.ruleset</CodeAnalysisRuleSet>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
<DebugType>Full</DebugType>
<LangVersion>latest</LangVersion>
<HighEntropyVA>true</HighEntropyVA>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
</PropertyGroup>

<ItemGroup>
Expand All @@ -32,6 +35,7 @@
<PackageReference Include="Microsoft.CodeCoverage" Version="1.0.3" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.0.2" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.1.0" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta-63127-02" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.0-beta008" />
<PackageReference Include="Hl7.Fhir.STU3" Version="0.96.0" />
<PackageReference Include="System.Collections.Immutable" Version="1.5.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>

<IsPackable>false</IsPackable>
<CodeAnalysisRuleSet>..\..\CustomAnalysisRules.Test.ruleset</CodeAnalysisRuleSet>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
<LangVersion>latest</LangVersion>
<HighEntropyVA>true</HighEntropyVA>
<GeneratorProjectPath>..\..\tools\Microsoft.Health.Extensions.BuildTimeCodeGenerator\Microsoft.Health.Extensions.BuildTimeCodeGenerator.csproj</GeneratorProjectPath>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
</PropertyGroup>

<ItemGroup>
Expand All @@ -26,6 +29,7 @@
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.6.1" />
<PackageReference Include="Microsoft.CodeCoverage" Version="1.0.3" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="2.1.0" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta-63127-02" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.0-beta008" />
<PackageReference Include="Hl7.Fhir.STU3" Version="0.96.0" />
<PackageReference Include="Microsoft.Azure.DocumentDB.Core" Version="2.0.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@

<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>

<IsPackable>true</IsPackable>
<CodeAnalysisRuleSet>..\..\CustomAnalysisRules.Test.ruleset</CodeAnalysisRuleSet>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<WarningsAsErrors />
<LangVersion>latest</LangVersion>
<HighEntropyVA>true</HighEntropyVA>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
</PropertyGroup>

<ItemGroup>
Expand Down Expand Up @@ -75,6 +76,7 @@

<ItemGroup>
<PackageReference Include="Hl7.Fhir.STU3" Version="0.96.0" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta-63127-02" />
<PackageReference Include="NSubstitute" Version="3.1.0" />
<PackageReference Include="xunit" Version="2.3.1" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
<DebugType>Full</DebugType>
<LangVersion>latest</LangVersion>
<HighEntropyVA>true</HighEntropyVA>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
</PropertyGroup>

<ItemGroup>
Expand All @@ -23,6 +26,7 @@
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.6.1" />
<PackageReference Include="Microsoft.CodeCoverage" Version="1.0.3" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.0.2" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta-63127-02" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.0-beta008" />
<PackageReference Include="System.Net.Http" Version="4.3.3" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<PackageId>Microsoft.Health.Fhir.Web</PackageId>
<Authors>Microsoft.Health.Fhir.Web</Authors>
<CodeAnalysisRuleSet>..\..\CustomAnalysisRules.ruleset</CodeAnalysisRuleSet>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<WarningsAsErrors />
<!-- Due to the bug in VS, The DebugType needs to be set to Full for CodeCoverage to work property. Remove after the fix is deployed.-->
<DebugType>Full</DebugType>
<IsPackable>true</IsPackable>
<LangVersion>latest</LangVersion>
<HighEntropyVA>true</HighEntropyVA>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
</PropertyGroup>

<ItemGroup>
Expand All @@ -24,6 +24,7 @@
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.6.1" />
<PackageReference Include="Microsoft.CodeCoverage" Version="1.0.3" />
<PackageReference Include="Microsoft.Extensions.Configuration.AzureKeyVault" Version="2.0.2" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta-63127-02" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.0-beta008" />
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.3.0" />
<PackageReference Include="Microsoft.AspNetCore" Version="2.1.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
<CodeAnalysisRuleSet>..\..\CustomAnalysisRules.Test.ruleset</CodeAnalysisRuleSet>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<WarningsAsErrors />
<IsPackable>true</IsPackable>
<CodeAnalysisRuleSet>..\..\CustomAnalysisRules.Test.ruleset</CodeAnalysisRuleSet>
<LangVersion>latest</LangVersion>
<HighEntropyVA>true</HighEntropyVA>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<WarningsAsErrors />
<IsPackable>false</IsPackable>
<CodeAnalysisRuleSet>..\..\CustomAnalysisRules.Test.ruleset</CodeAnalysisRuleSet>
<LangVersion>latest</LangVersion>
<HighEntropyVA>true</HighEntropyVA>
</PropertyGroup>
Expand Down

0 comments on commit 239cf15

Please sign in to comment.