Skip to content

/t:Pack /p:Version not handling dependency versions #1320

@dazinator

Description

@dazinator

Given a solution with two projects, "Foo.csproj" with a project reference to "Bar.csproj"

When doing an msbuild My.sln /t:Pack /p:Version="1.0.0-alpha"

Foo produces a nuget package version "1.0.0-alpha"
Bar produces a nuget package version "1.0.0-apha"

Inside the nuget package for Foo is a nuspec file, with Bar listed as a dependency (correct). The version of that dependency shows as 1.0.0. This is incorrect. When these nuget packages are published to a feed, and Foo is then installed by a client - the client will complain that Bar version 1.0.0 doesn't exist on the feed, or perhaps it does exist by coincidence and it will be downloaded even though it's not actually the correct version for the dependency.

The dependency package (bar) was produced with a Version number, and therefore when a dependency element is generated in foo's nuspec, for the 'bar' package, that element should honour that version number, not be left as 1.0.0 which is incorrect.

Do you have any other suggestions as to how to overcome this limitation in the short term? Perhaps there is something I am missing? I would prefer not to have to manually create and maintain nuspec files to fix this as that's quite a big overhead for some of our solutions that have upwards of 50 projects each.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions