Skip to content

no-duplicate-include

XMLcorrectnessno fixdefault: warn

Reports an element of a project file (PackageReference, ProjectReference, Compile, …) that has the same Include as an earlier element of the same name in the same parent, on the later one.

The repeat is a restore warning or a build error, and where it is not it is dead text that hides which of the two a later edit should change.

To fix, delete the repeat.

Reported
...
<ItemGroup>
<PackageReference Include="A" Version="1" />
<PackageReference Include="B" Version="1" />
<PackageReference Include="A" Version="2"></PackageReference>
<Compile Include="A" />
<ProjectReference Include="B" />
</ItemGroup>
...
xml:
lint:
rules:
no-duplicate-include: warn # off, warn (default), error

Suppress one line with sudsy-disable-next-line no-duplicate-include in a comment of the file’s language.