File tree Expand file tree Collapse file tree 2 files changed +59
-0
lines changed Expand file tree Collapse file tree 2 files changed +59
-0
lines changed Original file line number Diff line number Diff line change @@ -145,6 +145,7 @@ reported a the [GibHub repository](https://github.com/dotnet-project-file-analyz
145145### Other
146146* [ ** Proj1100** Avoid using Moq] ( rules/Proj1100.md )
147147* [ ** Proj1101** Package references should have stable versions] ( rules/Proj1101.md )
148+ * [ ** Proj1102** Use Coverlet Collector or MSBuild] ( rules/Proj1102.md )
148149* [ ** Proj1200** Exclude private assets as project file dependency] ( rules/Proj1200.md )
149150
150151## Resource file rules
Original file line number Diff line number Diff line change 1+ ---
2+ parent : Other
3+ ancestor : MSBuild
4+ ---
5+
6+ # Proj1102: Use Coverlet Collector or MSBuild
7+ [ Coverlet] ( https://github.com/coverlet-coverage/coverlet ) is a cross-platform
8+ code coverage framework for .NET, with support for line, branch and method
9+ coverage. The packages ` coverlet.collector ` and ` coverlet.msbuild ` have the
10+ same purpose but should not be used together. Note that ` coverlet.collector ` is
11+ preferred over the ` coverlet.msbuild ` .
12+
13+ ## Non-compliant
14+ ``` xml
15+ <Project Sdk =" Microsoft.NET.Sdk" >
16+
17+ <PropertyGroup >
18+ <TargetFramework >net8.0</TargetFramework >
19+ </PropertyGroup >
20+
21+ <ItemGroup >
22+ <PackageReference Include =" coverlet.collector" PrivateAssets =" all" />
23+ <PackageReference Include =" coverlet.msbuild" PrivateAssets =" all" />
24+ </ItemGroup >
25+
26+ </Project >
27+ ```
28+
29+ ## Compliant
30+ ``` xml
31+ <Project Sdk =" Microsoft.NET.Sdk" >
32+
33+ <PropertyGroup >
34+ <TargetFramework >net8.0</TargetFramework >
35+ </PropertyGroup >
36+
37+ <ItemGroup >
38+ <PackageReference Include =" coverlet.collector" PrivateAssets =" all" />
39+ </ItemGroup >
40+
41+ </Project >
42+ ```
43+
44+ or
45+
46+ ``` xml
47+ <Project Sdk =" Microsoft.NET.Sdk" >
48+
49+ <PropertyGroup >
50+ <TargetFramework >net8.0</TargetFramework >
51+ </PropertyGroup >
52+
53+ <ItemGroup >
54+ <PackageReference Include =" coverlet.msbuild" PrivateAssets =" all" />
55+ </ItemGroup >
56+
57+ </Project >
58+ ```
You can’t perform that action at this time.
0 commit comments