microsoft / microsoft/winget-cli-restsource
Fresh clone build fails due to duplicate package reference
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 317
- Forks
- 79
- PR merge metrics
- No merged PRs in 30d
Description
Brief description of your issue
This is different than the issue in #148, but the issue I'm experiencing was reported in part in the comments by @hancockl.
I'm internal to Microsoft so I'm not running into the package source permission issue, but I am running into a problem where when I try to open the solution in Visual Studio 2022, the build fails due to this error:
Error NU1504 Duplicate 'PackageReference' items found. Remove the duplicate items or use the Update functionality to ensure a consistent restore behavior. The duplicate 'PackageReference' items are: Microsoft.WindowsPackageManager.Utils 0.3.4, Microsoft.WindowsPackageManager.Utils *. WinGet.RestSource.Utils C:\src\winget-cli-restsource\src\WinGet.RestSource.Utils\WinGet.RestSource.Utils.csproj 1
In WinGet.RestSource.Utils.csproj, there are indeed duplicate PackageReference items for Microsoft.WindowsPackageManager.Utils (link):
<ItemGroup>
<PackageReference Include="Microsoft.Azure.Cosmos" Version="3.22.0" />
<PackageReference Include="Microsoft.WindowsPackageManager.Utils" Version="0.3.4" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Http" Version="3.0.12" />
<PackageReference Include="Microsoft.WindowsPackageManager.Utils" Version="*" />
</ItemGroup>
Deleting either of the two Microsoft.WindowsPackageManager.Utils PackageReferences elements appears to be adequate for the build to complete.
Steps to reproduce
Fresh clone of repo, attempt to build .sln in Visual Studio
Expected behavior
Works
Actual behavior
Doesn't work
Environment
Windows 10
Visual Studio 2022
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Open src/WinGet.RestSource.Utils/WinGet.RestSource.Utils.csproj and inspect the Microsoft.WindowsPackageManager.Utils PackageReference entries shown in the issue. Build the solution in Visual Studio 2022 from a fresh checkout to confirm the NU1504 error. Done means the duplicate reference is gone and the solution builds successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100