Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ reported a the [GibHub repository](https://github.com/dotnet-project-file-analyz
### Other
* [**Proj1100** Avoid using Moq](rules/Proj1100.md)
* [**Proj1101** Package references should have stable versions](rules/Proj1101.md)
* [**Proj1102** Use Coverlet Collector or MSBuild](rules/Proj1102.md)
* [**Proj1103** Coverlet requires Microsoft.NET.Test.Sdk 17.5.0 or higher](rules/Proj1103.md)
* [**Proj1200** Exclude private assets as project file dependency](rules/Proj1200.md)

## Resource file rules
Expand Down
57 changes: 57 additions & 0 deletions rules/Proj1102.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
parent: Other
ancestor: MSBuild
---

# Proj1102: Use Coverlet Collector or MSBuild
Coverlet is a cross-platform code coverage framework for .NET, with support for
line, branch and method coverage. The packages `coverlet.collector` and
`coverlet.msbuild` have the same purpose but should not be used together. Note
that `coverlet.collector` is preferred over the `coverlet.msbuild`.

## Non-compliant
``` xml
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="coverlet.collector" PrivateAssets="all" />
<PackageReference Include="coverlet.msbuild" PrivateAssets="all" />
</ItemGroup>

</Project>
```

## Compliant
``` xml
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="coverlet.collector" PrivateAssets="all" />
</ItemGroup>

</Project>
```

or

``` xml
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="coverlet.msbuild" PrivateAssets="all" />
</ItemGroup>

</Project>
```
41 changes: 41 additions & 0 deletions rules/Proj1103.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
parent: Other
ancestor: MSBuild
---

# Proj1103: Coverlet requires Microsoft.NET.Test.Sdk 17.5.0 or higher
Coverlet is a cross-platform code coverage framework for .NET, with support for
line, branch and method coverage. It requires `Microsoft.NET.Test.Sdk` 17.5.0
or higher.

## Non-compliant
``` xml
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.0" />
<PackageReference Include="coverlet.collector" PrivateAssets="all" />
</ItemGroup>

</Project>
```

## Compliant
``` xml
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="coverlet.collector" PrivateAssets="all" />
</ItemGroup>

</Project>
```
Loading