Skip to content

[Bug]: Centralized Package Versioning causes NU1008 from included .targets files using non-centralized PackageReferences #11967

@dtarjeft

Description

@dtarjeft

NuGet Product Used

dotnet.exe, MSBuild.exe, NuGet.exe

Product Version

dotnet 6.0.302, msbuild 16.11.2.50704, nuget 6.2.1.2

Worked before?

New issue encountered in upgrade process

Impact

I'm unable to use this version

Repro Steps & Context

  1. Create a C# project.
  2. Set up Centralized Package Versioning
  3. Install a package that contains a .targets file that has a PackageReference in it. Example of a .targets file that causes the issue:
    image
  4. Attempt to build.

What I expected:
A build that successfully handles the PackageReference's .targets' dependencies.

What I got:
NU1008, due to the referenced target file having declared a version.

This is a blocker for my team's adoption of CPVM, as any build helpers we have installed become build stoppers.

Verbose Logs

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area:RestoreCPMCentral package managementFunctionality:RestorePriority:3Issues under consideration. With enough upvotes, will be reconsidered to be added to the backlog.Type:Bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions