Skip to content

nuspec with any framework version not handled by PackageSourceGenerator #3361

@mthalman

Description

@mthalman

The PackageSourceGenerator for SBRP doesn't correctly generate ProjectReferences in the csproj for a package whose nuspec file defines a dependency with the any framework version.

Repro:

.\generate.cmd -p Microsoft.CodeAnalysis.CSharp,2.9.0 -e

You'll notice that the nuspec for that package defines this:

<dependencies>
  <dependency id="Microsoft.CodeAnalysis.Common" version="[2.9.0]" />
</dependencies>

There's no group element with a targetFramework element. This implicitly means the target framework is any. This is the value that will be returned when retrieving the TargetFramework metadata from the package dependency.

This causes the generated csproj to be missing a ProjectReference to the dependency because it fails to match on the target framework here: https://github.com/dotnet/source-build-reference-packages/blob/f9dc7282be60127425b58b40972374cdec0348ed/src/packageSourceGenerator/PackageSourceGeneratorTask/GenerateProject.cs#L75

Continuing the example, this means that Microsoft.CodeAnalysis.CSharp.4.0.1.csproj is generated with no reference to Microsoft.CodeAnalysis.Common.2.9.0.csproj.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-sbrpSource build reference packages

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions