.Net Standard Library 1.6.1 reference System.Net.Sockets from .NET Framework 4.0


#1

My problem might sound newbie but I can’t find any relevant information online, so I am asking here.

I have created a Class Library using .Net Standard Library 1.6.1 in VS 2017 Community Edition and wanted to use TcpClient class from System.Net.Sockets , but instead of having current TcpClient from .Net Framework 4.6 my application using an assembly from .NET 4.1 which is pretty annoying because the functionality is very limited in the old version of this class.

Further, I have deployed the library on Debian , installed .Net SDK and build the library there, having the same result, so it seems like the problem is in SDK libraries. Or maybe it is by design behaviour?
Looking at the table I’ve suggested that .NET Standard 1.6.1 uses .net 4.6 libraries because this version of .net is marked as “required”

So does .Net Standard Library 1.6.1 suppose to work like this?


#2

I am very confused.

I have created a Class Library using .Net Standard Library 1.6.1

There’s no such thing as “.Net Standard Library 1.6.1”. There is .Net Standard 1.1 through .Net Standard 1.6. And there’s also the NETStandard.Library 1.6.1 package. But the version of that package does not dictate which version of .Net Standard are you using.

using an assembly from .NET 4.1

There’s no such thing as .Net 4.1. Did you mean .Net Framework 4.5.1 or 4.6.1?

I have created a Class Library using .Net Standard Library […] my application using an assembly from .NET 4.1 […]

How is the library related to the application? How does what the application does affect what the library can do? Can’t you upgrade the application to a newer version of .Net Framework?

having the same result

What actually is the result? Could you explain what exactly did you do and what did it do?

Looking at the table I’ve suggested that .NET Standard 1.6.1 uses .net 4.6 libraries

.Net Standard does not use .Net Framework libraries at all. And what the table says is that for example a .Net Standard 1.5 library can only be referenced from a .Net Framework 4.6.2+ project (only look at the “with tooling 1.0” row). But since it’s not clear to me what version of .Net Standard or .Net Framework are you using, I can’t tell you the specifics.


#3

Thank you for the answer and sorry for my confusing description of the problem.

You have addressed my question here

.Net Standard does not use .Net Framework libraries at all. And what the table says is that for example a .Net Standard 1.5 library can only be referenced from a .Net Framework 4.6.2+ project (only look at the “with tooling 1.0” row).

I haven’t examined .Net Standard concept very well before asking, I eventually thought that .Net Standard 1.6 will use the implementation of TcpClient from .Net Framework 4.6.2 .


#4

.NET Standard 2.0 (final release) includes a compatibility shim for .NET Framework binaries, significantly
increasing the set of libraries that you can reference from your .NET Standard libraries.
reference: Reference

That meas, that you can reference a class library developed in version 4.6.1 from within .NetStandard project (and vise versa)
Practically, i build ns2 library and referenced net45 json.net and then referenced my ns2 library from netcore2 console application and working fine in windows 7.


.NET Foundation Website | Blog | Projects | Code of Conduct