You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
NuGet raises NU1201 compatibility error in projects that reference both a project and a package (transitively) with the same identity for different TFMs
#10617
Closed
ViktorHofer opened this issue
Mar 3, 2021
· 4 comments
NuGet product used (NuGet.exe | Visual Studio | MSBuild.exe | dotnet.exe): dotnet.exe
Product version: 5.0.100 / 6.0 Preview 1
Worked before? If so, with which NuGet version:
Repro steps and/or sample project
A project which references another project with the same identity as a transitive package reference causes NuGet's compatibility check to fail and believe that the supported tfms of the project apply to the package as well. That happens even if the both references are condition on different TargetFrameworks.
In this case we have a parent project called parent.csproj which multi-targts for net5.0 and netstandard2.0 and references a child project child1.csproj on netstandard2.0 which itself package references System.Memory which itself again has a package dependency on System.Numerics.Vectors. The System.Numerics.Vectors package supports i.e. netstandard2.0 but not net5.0. The parent project also references another project on net5.0 called System.Numerics.Vectors which supports net5.0. The same identities cause NuGet to throw a NU1201.
C:\temp\nugetnodes\parent>dotnet restore
Determining projects to restore...
C:\temp\nugetnodes\parent\parent.csproj : error NU1201: Project System.Numerics.Vectors is not compatible with netstandard2.0 (.NETStandard,Version=v2.0). Project System.Numerics.Vectors supports: net5.0 (.NETCoreApp,Version=v5.0)
Restored C:\temp\nugetnodes\child1\child1.csproj (in 276 ms).
Failed to restore C:\temp\nugetnodes\parent\parent.csproj (in 276 ms).
The text was updated successfully, but these errors were encountered:
ViktorHofer
changed the title
NuGet raises NU1201 compatibility error in projects that reference both a project and a package (transitively) with the same identity
NuGet raises NU1201 compatibility error in projects that reference both a project and a package (transitively) with the same identity for different TFMs
Mar 4, 2021
A project which references another project with the same identity as a transitive package reference
Without digging further, NuGet should select the project if the project & package have the same version.
Do you see the package getting selected in a graph where both are available?
If not, then this is likely by design.
Details about Problem
NuGet product used (NuGet.exe | Visual Studio | MSBuild.exe | dotnet.exe): dotnet.exe
Product version: 5.0.100 / 6.0 Preview 1
Worked before? If so, with which NuGet version:
Repro steps and/or sample project
A project which references another project with the same identity as a transitive package reference causes NuGet's compatibility check to fail and believe that the supported tfms of the project apply to the package as well. That happens even if the both references are condition on different TargetFrameworks.
In this case we have a parent project called
parent.csproj
which multi-targts fornet5.0
andnetstandard2.0
and references a child projectchild1.csproj
onnetstandard2.0
which itself package referencesSystem.Memory
which itself again has a package dependency onSystem.Numerics.Vectors
. TheSystem.Numerics.Vectors
package supports i.e.netstandard2.0
but notnet5.0
. The parent project also references another project onnet5.0
calledSystem.Numerics.Vectors
which supportsnet5.0
. The same identities cause NuGet to throw a NU1201.dotnet restore nugetnodes\parent\parent.csproj
Verbose Logs
cc @nkolev92 @rrelyea @safern @ericstj
The text was updated successfully, but these errors were encountered: