Skip to content

Commit 16eda38

Browse files
BertkdaveMueller
andauthored
fix MergeWith option (#1601)
* fix MergeWith (net8.0 and net7.0) * use range operator * add JsonSerializerOptions * consolidate nuget package versions * incorporate review comments * sanitize report path for all output variations --------- Co-authored-by: David Müller <[email protected]>
1 parent 16b9883 commit 16eda38

File tree

31 files changed

+273
-351
lines changed

31 files changed

+273
-351
lines changed

.config/dotnet-tools.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"isRoot": true,
44
"tools": {
55
"dotnet-reportgenerator-globaltool": {
6-
"version": "5.2.0",
6+
"version": "5.2.1",
77
"commands": [
88
"reportgenerator"
99
]

Directory.Build.props

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,25 @@
5353
<MicrosoftBuildUtilitiesCorePackageVersion>15.9.20</MicrosoftBuildUtilitiesCorePackageVersion>
5454
<SystemReflectionMetadataVersion>1.6.0</SystemReflectionMetadataVersion>
5555
<SystemCollectionsImmutableVersion>1.5.0</SystemCollectionsImmutableVersion>
56+
57+
<!-- some additional information about dependency management limitations for MSBuild tasks (coverlet.msbuild.tasks)
58+
- msBuild task with dependencies https://natemcmaster.com/blog/2017/11/11/msbuild-task-with-dependencies/
59+
- Aligning versions with MSBuild
60+
- If you need a dependency that is also used in MSBuild itself, you have to align with the version MSBuild uses.
61+
- This includes System.Reflection.Metadata, System.Collections.Immutable, NuGet, Newtonsoft.Json, and others.
62+
- See example: dependencies.props (https://github.com/aspnet/BuildTools/blob/1f3f14382764e06b7e691e5ee89d12a280249284/build/dependencies.props#L19-L29)"
63+
64+
.NET 8.0.3xx (MSBuild) core-sdk-tasks version details https://github.com/dotnet/installer/blob/release/8.0.3xx/src/core-sdk-tasks/core-sdk-tasks.csproj
65+
66+
ALIGN PACKAGE VERSIONS of coverlet.core with coverlet.collector (vstest) and coverlet.msbuild.tasks (.NET SDK MSBuild)
67+
68+
e.g. candidates for version conflicts:
69+
<MicrosoftBuildTaskVersion>15.7.179</MicrosoftBuildTaskVersion>
70+
<MicrosoftBuildTaskUtilitiesCoreVersion>15.7.179</MicrosoftBuildTaskUtilitiesCoreVersion>
71+
<NuGetBuildTasksPackageVersion>6.9.0-rc.86</NuGetBuildTasksPackageVersion>
72+
<MicrosoftBuildTaskSystemReflectionMetaData>1.4.2</MicrosoftBuildTaskSystemReflectionMetaData>
73+
<MicrosoftBuildTaskSystemCollectionImmutable>1.5.0</MicrosoftBuildTaskSystemCollectionImmutable> >= 1.3.1
74+
-->
5675
</PropertyGroup>
5776

5877
</Project>

Directory.Packages.props

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@
2929
vstest 17.8 version
3030
NuGetFrameworksVersion is defined here https://github.com/microsoft/vstest/blob/9a0c41811637edf4afe0e265e08fdd1cb18109ed/eng/Versions.props#L94C1-L94C1
3131
-->
32+
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
3233
<PackageVersion Include="NuGet.Frameworks" Version="6.8.0" />
3334
<PackageVersion Include="NuGet.Packaging" Version="6.8.0" />
3435
<PackageVersion Include="NuGet.Versioning" Version="6.8.0" />
3536
<PackageVersion Include="Mono.Cecil" Version="0.11.5" />
36-
<PackageVersion Include="Moq" Version="4.20.69" />
37-
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
38-
<PackageVersion Include="ReportGenerator.Core" Version="5.2.0" />
37+
<PackageVersion Include="Moq" Version="4.20.70" />
38+
<PackageVersion Include="ReportGenerator.Core" Version="5.2.1" />
3939
<!--For test issue 809 https://github.com/coverlet-coverage/coverlet/issues/809-->
4040
<PackageVersion Include="LinqKit.Microsoft.EntityFrameworkCore" Version="7.1.4" />
4141
<PackageVersion Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
@@ -44,11 +44,11 @@
4444
<PackageVersion Include="System.Configuration.ConfigurationManager" Version="8.0.0" />
4545
<PackageVersion Include="System.Linq.Async" Version="6.0.1" />
4646
<PackageVersion Include="System.Reflection.Metadata" Version="8.0.0" />
47-
<PackageVersion Include="System.Text.Json" Version="8.0.0" />
47+
<PackageVersion Include="System.Text.Json" Version="8.0.1" />
4848
<PackageVersion Include="Tmds.ExecFunction" Version="0.7.1" />
49-
<PackageVersion Include="xunit" Version="2.6.5" />
49+
<PackageVersion Include="xunit" Version="2.6.6" />
5050
<PackageVersion Include="xunit.assemblyfixture" Version="2.2.0" />
51-
<PackageVersion Include="xunit.assert" Version="2.6.5" />
51+
<PackageVersion Include="xunit.assert" Version="2.6.6" />
5252
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.6" />
5353
<PackageVersion Include="System.Buffers" Version="4.5.1" />
5454
<PackageVersion Include="System.Memory" Version="4.5.5" />

Documentation/Examples/MSBuild/DeterministicBuild/XUnitTestProject1/XUnitTestProject1.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
<ItemGroup>
1010
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
11-
<PackageReference Include="xunit" Version="2.6.5" />
11+
<PackageReference Include="xunit" Version="2.6.6" />
1212
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6">
1313
<PrivateAssets>all</PrivateAssets>
1414
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>

Documentation/Examples/MSBuild/MergeWith/XUnitTestProject1/XUnitTestProject1.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1313
</PackageReference>
1414
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
15-
<PackageReference Include="xunit" Version="2.6.3" />
16-
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.5">
15+
<PackageReference Include="xunit" Version="2.6.6" />
16+
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6">
1717
<PrivateAssets>all</PrivateAssets>
1818
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
1919
</PackageReference>

Documentation/Examples/MSBuild/MergeWith/XUnitTestProject2/XUnitTestProject2.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1313
</PackageReference>
1414
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
15-
<PackageReference Include="xunit" Version="2.6.5" />
15+
<PackageReference Include="xunit" Version="2.6.6" />
1616
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6">
1717
<PrivateAssets>all</PrivateAssets>
1818
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>

Documentation/Examples/MSBuild/MergeWith/XUnitTestProject3/XUnitTestProject3.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1313
</PackageReference>
1414
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
15-
<PackageReference Include="xunit" Version="2.6.5" />
15+
<PackageReference Include="xunit" Version="2.6.6" />
1616
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6">
1717
<PrivateAssets>all</PrivateAssets>
1818
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>

Documentation/Examples/VSTest/DeterministicBuild/XUnitTestProject1/XUnitTestProject1.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
<ItemGroup>
1010
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
11-
<PackageReference Include="xunit" Version="2.6.5" />
11+
<PackageReference Include="xunit" Version="2.6.6" />
1212
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6">
1313
<PrivateAssets>all</PrivateAssets>
1414
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>

Documentation/Examples/VSTest/HelloWorld/XUnitTestProject1/XUnitTestProject1.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
<ItemGroup>
1111
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
12-
<PackageReference Include="xunit" Version="2.6.5" />
12+
<PackageReference Include="xunit" Version="2.6.6" />
1313
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6">
1414
<PrivateAssets>all</PrivateAssets>
1515
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>

Documentation/MSBuildIntegration.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,15 @@ To specify a directory where all results will be written to (especially if using
5050
dotnet test /p:CollectCoverage=true /p:CoverletOutput='./results/'
5151
```
5252

53+
_Note: escape characters might produce some unexpected results._
54+
55+
|status| msbuild parameter |
56+
|---|---|
57+
|:heavy_check_mark:|`/p:CoverletOutput="C:/GitHub/coverlet/artifacts/Reports/coverlet.core/"`|
58+
|:heavy_check_mark:|`/p:CoverletOutput="C:\\GitHub\\coverlet\\artifacts\\Reports\\coverlet.core\\"`|
59+
|:heavy_check_mark:|`/p:CoverletOutput="C:\GitHub\coverlet\artifacts\Reports\coverlet.core\\"`|
60+
|:x:|`/p:CoverletOutput="C:\GitHub\coverlet\artifacts\Reports\coverlet.core\"`|
61+
5362
The Coverlet MSBuild task sets the `CoverletReport` MSBuild item so that you can easily use the produced coverage reports. For example, using [ReportGenerator](https://github.com/danielpalme/ReportGenerator#usage--command-line-parameters) to generate an html coverage report.
5463

5564
```xml

0 commit comments

Comments
 (0)