Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

An unexpected warning “NU1505: Duplicate 'PackageDownload' items found” occurs after build tools restoring #11720

Closed
v-crchang opened this issue Apr 7, 2022 · 4 comments
Assignees
Labels
Found:ManualTests Partner:CLI-SDK Priority:2 Issues for the current backlog. Resolution:External This issue appears to be External to nuget Type:Bug

Comments

@v-crchang
Copy link

NuGet Product Used

Other/NA

Product Version

BuildTools vsix\6.3.0.10

Worked before?

Dev\6.2.0.120

Impact

It bothers me. A fix would be nice

Repro Steps & Context

Repro steps:

  1. Install Visual Studio Build Tools 2022 Preview.
  2. Download the BuildTools vsix (6.3.0.10) from https://devdiv.visualstudio.com/_apis/resources/Containers/10237311/VS15?itemPath=VS15%2FMicrosoft.VisualStudio.NuGet.BuildTools.vsix
  3. Right click on the VSIX, check Unblock, and press Apply.
  4. Extract the vsix locally using 7-Zip or the likes.
  5. Go to the extracted folder and copy the contents of the folder: Contents\Common7\IDE\CommonExtensions\Microsoft\NuGet.
  6. Copy those files to C:\Program Files (x86)\ Microsoft Visual Studio\2022\Preview\Common7\IDE\CommonExtensions\Microsoft\NuGet.
  7. Create a .NET Core Console App project with PackageReference package installed.
  8. Run “msbuild /t:restore” in Developer Command Prompt for VS 2022 Preview.

Expected:

The restore build succeed without any warning.

Actual:

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.
image

Note:

  1. The issue does not repro on NuGet Client Dev\6.2.0.120.

Verbose Logs

No response

@nkolev92
Copy link
Member

nkolev92 commented Apr 7, 2022

I think this is ok and by design.

This was added in #9864.

We should file this issue in the SDK repo.

I'll do that and close out this issue.

@nkolev92
Copy link
Member

nkolev92 commented Apr 7, 2022

@v-luzh Can you please post the csproj content in dotnet/sdk#24747?
Thanks!

@nkolev92 nkolev92 closed this as completed Apr 7, 2022
@nkolev92 nkolev92 added Resolution:External This issue appears to be External to nuget Partner:CLI-SDK and removed Resolution:ByDesign This issue appears to be ByDesign Triage:Untriaged labels Apr 7, 2022
@nkolev92
Copy link
Member

Thanks for posting the repro in the issue @v-crchang

@Nirmal4G
Copy link

Nirmal4G commented Oct 8, 2022

I could've hit this too but fortunately for us, we use a private build of NuGet.Build.Tasks and don't trust you guys! 😅🙃😉

I think this is ok and by design.

Not a good reason and a huge NO. If this is a CPS limitation, then CPS should figure out how to say uniqueness for a particular MSBuild item type. For Example, PackageDownload can be unique with version specified since you only allow exact version. And CPS should include version info for uniqueness check just for PackageDownload items when it's specified. De-duplication breaks PackageDownload items as they are allowed to have duplicates across versions. MSBuild itself allows duplicates in the items which VS Project System should handle accordingly.

I know that the team recently added multiple versions in Version attribute, but it's confusing, especially for new Devs looking into a huge codebase. We tried it and then we had to revert it because of the confusion. At least you could've provided Versions attribute for multiple versions in PackageDownload.

People who are a bit advanced might complain, Why are there two ways to include versions? Just like they are complaining with the TargetFramework(s) properties. But I don't see any complaints from Devs who are new to .NET! This is why I didn't raise any issue for this.

But what I'm waiting for is #7709 and #8476 to work. If that does work, then all those ramblings above would be nullified in sheer bliss that I would get removing huge chunk of code that implements custom PackageDownload! YEAH!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Found:ManualTests Partner:CLI-SDK Priority:2 Issues for the current backlog. Resolution:External This issue appears to be External to nuget Type:Bug
Projects
None yet
Development

No branches or pull requests

4 participants