This repository has been archived by the owner on Sep 13, 2022. It is now read-only.
Transitive dependency(PackageReference/ProjectReference)not working when app and libs has different targetFramework #1149
Labels
Milestone
Also report as dotnet/sdk#3103, dotnet/core#2571.
Reference transitive not working when app and lib has different targetFramework, and the lib use an transitive dependency from special targetFramework of an multi-targetFramework PackageReference/ProjectReference
That mainly affect reference any libraries which target single
netstandard2.0
and reference other multi-targetFramework libraries , as it give no warn/error at build time.Step:
Tested with dotnet-sdk : 3.0.100-preview3-010431, 2.1.504 and some other version
Run ConsoleApp5 in https://github.com/yyjdelete/test_dotnet_indirect_dependency
And see an FileNotFoundException for
System.Data.SqlClient, Version=4.5.0.0
(Ignore the MissingMethodException, as it's expected #1052 (comment)). The same if replaceClassLibrary1
andClassLibrary2
with packed.nupkg
Project struct:
Expected:
The
System.Data.SqlClient
should be include in the output bins ofConsoleApp5
, if used byClassLibrary1(netstandard2.0)
.Or at least give an warning, to make people know which Reference must be added explicitly. It's almost impossibe to find all of them by hand in an project with deep reference transitive(can also be something in nupkg).
VisualStudio should show the same result of project struct as the output does, and
System.Data.SqlClient
should be include again withClassLibrary1(netstandard2.0)
if it's removed withClassLibrary2(net472)
I already know it's reasonable to reference
ClassLibrary2
withnet472
(runtime) instead ofnetstandard2.0
, so ignore theMissingMethodException
.Actual:
System.Data.SqlClient
is missing from the output, even it's used byClassLibrary1(netstandard2.0)
, and get anFileNotFoundException
when execute.The text was updated successfully, but these errors were encountered: