Skip to content

NU1505: Duplicate 'PackageDownload' items warning is raised when the SDK uses PackageDownload to get packages.  #24747

@nkolev92

Description

@nkolev92

Describe the bug

Recently NuGet added warnings for duplicate PackageReference/PackageDownload/PackageVersion items. Duplicate items could lead to an unpredictable behavior. You can learn about the motivation more in NuGet/Home#9864.
https://github.com/NuGet/Home/blob/dev/proposed/2022/duplicate-nuget-item-error-handling.md

NuGet added this in 6.0.400, so customers will start seeing this very soon.

To Reproduce

Originally filled in NuGet/Home#11720.

  1. Use latest SDK with NuGet version 6.3.0 or higher. Might not be 100% inserted today.
  2. Create a .NET Core Console App, netcoreapp3.1. project with PackageReference package installed.
  3. Run “dotnet restore” in Developer Command Prompt for VS 2022 Preview
  4. The warning “warning NU1505: Duplicate 'PackageDownload' items found. Remove the duplicate items or use the Update functionality to ensure a consistent restore behavior.” occurs as below screenshot.

This was was discovered by the NuGet test team, @v-luzh Can you please post the csproj in question?

162154703-64f6f300-1ada-41d3-a092-d9da82d8fea2

Why is this important?

NuGet will raise a warning when it sees duplicate items, and warning as errors could cause failures for customers.

Exceptions (if any)

Further technical details

  • Include the output of dotnet --info
  • The IDE (VS / VS Code/ VS4Mac) you're running on, and its version
    Latest main version of NuGet tooling will have this.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions