microsoft/winget-cli-restsource

Fresh clone build fails due to duplicate package reference

Opened this issue · 0 comments

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