I built a C# application, my target framework was .NET Framework 4.72. While I used TDengine C# connector, and its target framework is .NET Standard 2.1 and .NET 5.
While I reference these package in the project, I always get an error while building, which said that the method marshal.
Marshal.StringToCoTaskMemUTF8(String)
was not in Framework 4.7.2.
I am confused, since in my opinion 4.7.2 should be a lower version than .NET 5. And this should be compatible.
So what is the difference between .NET Standard vs .NET Framework .NET 5, 6, 7. These name always confusing me. Does any know how to distinguish them or suggest some article to help me know them.
CodePudding user response:
Yeah this is very confusing!
.NET Core was a rewrite of the .NET Framework in order to make it platform-independent. It has a number of incompatibilities with the classic .NET Framework (.NET up until version 4.8). Newer versions of .NET from version 5 and forward are based on the Core fork, so are not fully compatible with the older version up until 4.8.
.NET Standard was an attempt to create a common subset that was compatible across all versions. So if you programmed against .NET Standard, you code would work both with the 4.8 branch and the Core branch. Unfortunately, MS botched this by making a version of .NET Standard which wasn't compatible with .NET 4.8. They probably did this out of spite towards .NET developers.
Major .NET framework versions:
.NET Framework 1.0 -> .NET Framework 2.0 -> .NET Framework 3.0 -> .NET Framework 3.5 -> .NET Framework 4.0 -> .NET Framework 4.8
Major .NET Core versions:
.NET Core 1 -> .NET core 2 -> .NET Core 3 -> .NET 5 -> .NET 6
CodePudding user response:
As it is indeed confusing, I tried to figure it out myself lately. Here is what I came up with:
.NET and .NET Core are successors of .NET Framework.
Since Version 5, .NET Core is only called .NET:
- .NET Core 1.0
- .NET Core 1.1
- .NET Core 2.0
- .NET Core 2.1
- .NET Core 2.2
- .NET Core 3.0
- .NET Core 3.1
- .NET 5
- .NET 6
- .NET 7
- .NET 8
.NET Framework runs from Version 1.0 to 4.8 and the Version numbers can't be compared with those of .NET Core or .NET respectively.
.NET Standard is not a framework or platform itself. It just sets specifications (standards) for the .NET implementations to be ".NET Standard compliant". Here you can see a list of the different .NET Standard versions and the .NET implementations and versions they support.