Skip to content

Reference transitive not working well when app and libs has different targetFramework, and lib use an transitive reference from special targetFramework of an multi-targetFramework PackageReference/ProjectReference #3103

Open
@yyjdelete

Description

@yyjdelete

Sdk Version: 3.0.100-preview3-010431, 2.1.504
Run ConsoleApp5 in https://github.com/yyjdelete/test_dotnet_indirect_dependency
And see an MissingMethodException and an FileNotFoundException for System.Data.SqlClient, Version=4.5.0.0

This can also happen with PackageReference. I reference Dapper from an ClassLibrary with netstandard2.0, and the main App is net472, and failed to found System.Data.SqlClient, Version=4.5.0.0.

Project struct:

ConsoleApp5(net472)
|--ClassLibrary1(netstandard2.0)
---|--ClassLibrary2(netstandard2.0;net472)
------|--System.Data.SqlClient(when netstandard2.0)

Expected:
The FileNotFoundException not happen and the System.Data.SqlClient, Version=4.5.0.0 is include in the output bins.
The below behavior may be not expected, but it's the current behavior for project struct(dependencies) in VS2019. (Rider follow the actual behavior for project struct)

ConsoleApp5(net472)
|--ClassLibrary1(netstandard2.0)
---|--ClassLibrary2(netstandard2.0)
------|--System.Data.SqlClient(netstandard2.0)

Actual:

ConsoleApp5(net472)
|--ClassLibrary1(netstandard2.0)
---|--System.Data.SqlClient(missing from the output of ConsoleApp5)
---|--ClassLibrary2(net472)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions