Skip to content

Source build creates duplicate PackageReferences #3372

@tmat

Description

@tmat

PR dotnet/sdk#31632 adds the following dependencies to Version.details.xml:

   <Dependency Name="Microsoft.Build.Tasks.Git" Version="1.2.0-beta-23207-01">
      <Uri>https://github.com/dotnet/sourcelink</Uri>
      <Sha>31a772fb8b2e3430e91766cdb169fba379f0d013</Sha>
      <SourceBuild RepoName="sourcelink" ManagedOnly="true" />
    </Dependency>
    <Dependency Name="Microsoft.SourceLink.Common" Version="1.2.0-beta-23207-01">
      <Uri>https://github.com/dotnet/sourcelink</Uri>
      <Sha>31a772fb8b2e3430e91766cdb169fba379f0d013</Sha>
      <SourceBuild RepoName="sourcelink" ManagedOnly="true" />
    </Dependency>
    <Dependency Name="Microsoft.SourceLink.AzureRepos.Git" Version="1.2.0-beta-23207-01">
      <Uri>https://github.com/dotnet/sourcelink</Uri>
      <Sha>31a772fb8b2e3430e91766cdb169fba379f0d013</Sha>
      <SourceBuild RepoName="sourcelink" ManagedOnly="true" />
    </Dependency>
    <Dependency Name="Microsoft.SourceLink.GitHub" Version="1.2.0-beta-23207-01">
      <Uri>https://github.com/dotnet/sourcelink</Uri>
      <Sha>31a772fb8b2e3430e91766cdb169fba379f0d013</Sha>
      <SourceBuild RepoName="sourcelink" ManagedOnly="true" />
    </Dependency>
    <Dependency Name="Microsoft.SourceLink.GitLab" Version="1.2.0-beta-23207-01">
      <Uri>https://github.com/dotnet/sourcelink</Uri>
      <Sha>31a772fb8b2e3430e91766cdb169fba379f0d013</Sha>
      <SourceBuild RepoName="sourcelink" ManagedOnly="true" />
    </Dependency>
    <Dependency Name="Microsoft.SourceLink.BitBucket.Git" Version="1.2.0-beta-23207-01">
      <Uri>https://github.com/dotnet/sourcelink</Uri>
      <Sha>31a772fb8b2e3430e91766cdb169fba379f0d013</Sha>
      <SourceBuild RepoName="sourcelink" ManagedOnly="true" />
    </Dependency>

This causes multiple PackageReferences to the same package to be added by
https://github.com/dotnet/arcade/blob/1db5a29a3a9c8982c784cbe00f44ea1dbed7b680/src/Microsoft.DotNet.Arcade.Sdk/tools/SourceBuild/SourceBuildArcadeTools.targets#L29

❌.packages/microsoft.dotnet.arcade.sdk/8.0.0-beta.23205.4/tools/Tools.proj(0,0): error NU1504: Warning As Error: 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.SourceBuild.Intermediate.sourcelink [1.2.0-beta-23207-01], Microsoft.SourceBuild.Intermediate.sourcelink [1.2.0-beta-23207-01], Microsoft.SourceBuild.Intermediate.sourcelink [1.2.0-beta-23207-01], Microsoft.SourceBuild.Intermediate.sourcelink [1.2.0-beta-23207-01], Microsoft.SourceBuild.Intermediate.sourcelink [1.2.0-beta-23207-01], Microsoft.SourceBuild.Intermediate.sourcelink [1.2.0-beta-23207-01].

Should these targets filter out duplicates based on repo name?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions