Runtime: NETFramework 4.6 project can not reference project that targets NETStandard 1.4?

Created on 12 Mar 2017  路  13Comments  路  Source: dotnet/runtime

According to the compatibility matrix my NETFramework 4.6 project should be able to reference libraries up to NetStandard 1.6 - correct? Why am I getting this error?

  2>------ Build started: Project: XUnitTestProject1, Configuration: Debug Any CPU ------
2>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Sdks\Microsoft.NET.Sdk\build\Microsoft.NET.Sdk.Common.targets(73,5): error : 
Project 'C:\bindingTest.csproj' targets '.NETStandard,Version=v1.4'. It cannot be referenced by a project that targets '.NETFramework,Version=v4.6'.
2>Done building project "bindingTest.csproj" -- FAILED.
area-Meta question

Most helpful comment

Same here. Spent couple of hours figuring out why I couldn't reference .Net Standard 1.6 library from .Net 4.6.2 project until I found non github version of the .NET Platforms Support matrix.

.Net Standard is already confusing to some (many?) people and having wrong/unclear documentation adds even more confusion.

All 13 comments

That's weird. Is that expected @terrajobst @ericstj? SDK bug?

cc @weshaggard

.NET 4.6 only supports up to .NET Standard 1.3 references based on that compatibility table. So this is expected.

Also note that the compatibility matrix at https://github.com/dotnet/standard/blob/master/docs/versions.md assumes the new set of tools coming with the .NET Standard 2.0 work. The table that is interesting for the released set of tools is https://github.com/dotnet/standard/blob/master/docs/versions.md but for .NET 4.6 the mapping is the same which is .NET Standard 1.3.

duh, I entirely misread the table the other way, should have caught it myself, sorry! :(

@weshaggard

The arrows indicate that the platform supports a higher version of .NET Standard.

Be clear about what "the platform" means.
In the row for .NET Framwork there are four "the platform"'s listed: 4.5, 4.5.1, 4.6, and 4.6.1
The logical way to read it is that the last "the platform" listed is the current one until it changes.

For instance, .NET Core 1.0 supports the .NET Standard version 1.6, which is why there are arrows pointing to the right for the lower versions 1.0 - 1.5.

This really says nothing since anything that supports 1.6 by definition supports 1.5, 1.4, etc. I read the table to mean that versions lower than 1.0 support up to 1.5.

better:
"The arrows indicate that the standard requires a higher version of the platform."

best:
Print the minimum version of the platform that implements the standard.

I agree the arrows do cause some confusion. @terrajobst some more feedback on our compat tables. Perhaps we should do away with the arrows completely now and just fill in the table completely.

I like the idea of filling the table fully - the arrows confused me as well (although I only skimmed the table and didn't truly use my brain fully :)). We can make the fillings in grey or smaller font if we want the highest supported NS pop from the table for each product version. But maybe that's an overkill ...

BTW: I'll be happy to make the changes if you guys don't have time.

Perhaps we should do away with the arrows completely now and just fill in the table completely.

I agree. Its a matter of finding where two lines intersect on a grid. Lets not make more of it than what it is.

@terrajobst

I hope corrective action is taken on this issue also. This last weekend was yet another complete waste of time. Its madding when everything is broken and even the documentation is incomprehensible and intentionally wrong. I actually find it inexcusable that inaccurate documentation is willfully posted. If that did not occur you are welcome to say so. But if it did - How are developers such as myself supposed to how the product installed on our machine is supposed to work? If nothing more its just common courtesy not to waste peoples time. Please get it fixed.

Same here. Spent couple of hours figuring out why I couldn't reference .Net Standard 1.6 library from .Net 4.6.2 project until I found non github version of the .NET Platforms Support matrix.

.Net Standard is already confusing to some (many?) people and having wrong/unclear documentation adds even more confusion.

Same here. I pride myself in my ability to Google the heck out of error messages and knowing what to do with them. But it took me multiple hours to find out the same thing Giorgi also discovered. Although part of that time was admittedly spent on figuring out what .NET Standard actually is.

I'm just starting a new class library project and I read everywhere that .NET Standard is the target you should want, when you're thinking cross platform compatibility. After an hour of trying to make it work (before I read the above), I parked that idea and targeted net462 instead. But at the time I thought it was due to a bug in VS2017 instead of actual incompatibility.

@pyrocumulus (and everyone else), can you please check if the docs changes @mairaw @weshaggard and @terrajobst are working on would have avoided some of the confusion you encountered? Is there more we should do?

@karelz both docs changes look very good. A lot clearer than before. As you've also said: the old table was understandable but only if you put your mind to it. These changes remove that aspect from it, they are just immediately clear.

I do also agree with @sam-wheat in https://github.com/dotnet/standard/pull/243 on putting some additional textual guidance on how to use the table. Just to be sure people reading it for the first time understand the two ways you can use it.

The various .NET runtimes implement specific versions of .NET Standard.

Suggest that "runtime" or "platform" is used - but not both. Or are they different? I am STILL confused by this!

The various .NET runtimes implement specific versions of .NET Standard.

Suggest: Various versions of the NET platforms implement different .NET Standards.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

omajid picture omajid  路  3Comments

bencz picture bencz  路  3Comments

jkotas picture jkotas  路  3Comments

GitAntoinee picture GitAntoinee  路  3Comments

Timovzl picture Timovzl  路  3Comments