diff --git a/.azure/pipelines/ci-official.yml b/.azure/pipelines/ci-official.yml
index 788dba044..df954a489 100644
--- a/.azure/pipelines/ci-official.yml
+++ b/.azure/pipelines/ci-official.yml
@@ -65,7 +65,23 @@ jobs:
inputs:
command: test
projects: '**/*Tests/*.csproj'
- arguments: '--configuration $(BuildConfiguration)'
+ arguments: '--configuration $(BuildConfiguration) --settings $(System.DefaultWorkingDirectory)/CodeCoverage.runsettings --collect:"XPlat Code Coverage" -- RunConfiguration.DisableAppDomain=true'
+
+ - task: DotNetCoreCLI@2
+ inputs:
+ command: custom
+ custom: tool
+ arguments: install --tool-path . dotnet-reportgenerator-globaltool
+ displayName: Install ReportGenerator tool
+
+ - script: reportgenerator -reports:$(Agent.TempDirectory)/**/coverage.cobertura.xml -targetdir:$(Build.SourcesDirectory)/coverlet/reports -reporttypes:"HtmlInline_AzurePipelines_Dark;Cobertura;Badges"
+ displayName: Create reports
+
+ - task: PublishCodeCoverageResults@1
+ displayName: 'Publish code coverage'
+ inputs:
+ codeCoverageTool: Cobertura
+ summaryFileLocation: $(Build.SourcesDirectory)/coverlet/reports/Cobertura.xml
- script: dotnet pack --configuration $(BuildConfiguration) --output $(Build.ArtifactStagingDirectory)
displayName: Pack
diff --git a/CodeCoverage.runsettings b/CodeCoverage.runsettings
new file mode 100644
index 000000000..f71a3aa61
--- /dev/null
+++ b/CodeCoverage.runsettings
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+ json,cobertura
+ Obsolete,GeneratedCodeAttribute,CompilerGeneratedAttribute
+ false
+ true
+ true
+
+
+
+
+
\ No newline at end of file
diff --git a/tests/BaGet.Core.Tests/BaGet.Core.Tests.csproj b/tests/BaGet.Core.Tests/BaGet.Core.Tests.csproj
index afe3c5b9c..9fa366add 100644
--- a/tests/BaGet.Core.Tests/BaGet.Core.Tests.csproj
+++ b/tests/BaGet.Core.Tests/BaGet.Core.Tests.csproj
@@ -12,6 +12,10 @@
all
runtime; build; native; contentfiles; analyzers
+
+ all
+ runtime; build; native; contentfiles; analyzers
+
diff --git a/tests/BaGet.Protocol.Tests/BaGet.Protocol.Tests.csproj b/tests/BaGet.Protocol.Tests/BaGet.Protocol.Tests.csproj
index 28ef0c18a..58faaee99 100644
--- a/tests/BaGet.Protocol.Tests/BaGet.Protocol.Tests.csproj
+++ b/tests/BaGet.Protocol.Tests/BaGet.Protocol.Tests.csproj
@@ -12,6 +12,10 @@
all
runtime; build; native; contentfiles; analyzers
+
+ all
+ runtime; build; native; contentfiles; analyzers
+
diff --git a/tests/BaGet.Tests/BaGet.Tests.csproj b/tests/BaGet.Tests/BaGet.Tests.csproj
index e1fc2f5fa..2e80d99c0 100644
--- a/tests/BaGet.Tests/BaGet.Tests.csproj
+++ b/tests/BaGet.Tests/BaGet.Tests.csproj
@@ -18,6 +18,10 @@
all
runtime; build; native; contentfiles; analyzers
+
+ all
+ runtime; build; native; contentfiles; analyzers
+