Skip to content

Latest commit

 

History

History
28 lines (19 loc) · 1.04 KB

File metadata and controls

28 lines (19 loc) · 1.04 KB
title NuGet Warning NU1509
description NU1509 warning code
author nkolev92
ms.author nikolev
ms.date 02/04/2025
ms.topic reference
f1_keywords
NU1509

NuGet Warning NU1509

Scenario 1

Duplicate 'PrunePackageReference' items found. Remove the duplicate items or use the Update functionality to ensure a consistent restore behavior. The duplicate 'PrunePackageReference' items are: X 1.0.0, X 2.0.0.

Issue

Sometimes when adding PrunePackageReference items, you may end up adding an item for a particular package multiple times.

MSBuild projects commonly import multiple .props and .targets files, so the duplicates might not be in the same file, but may be in imported files, such as Directory.Build.props, Directory.Packages.props, or Directory.Build.targets.

The .NET SDK provides a of list PrunePackageReference, so the conflict may be happening because you have specified a PrunePackageReference or due to a bug with the .NET SDK.

Solution

Remove the duplicate item, so that it's included exactly once.