Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Question regarding porting application from .Net Framework to .Net core

Tags:

.net

.net-core

In Microsoft's documentation on "Overview of the porting process" here in point #1 they mentions following

Retarget all projects you wish to port to target .NET Framework 4.7.2 or higher. This step ensures that you can use API alternatives for .NET Framework-specific targets when .NET Core doesn't support a particular API.

Can someone please help me to understand second sentence with some example? I failed to understand why it is needed to target projects to .Net Framework 4.7.2 before porting to .Net Core.

In another link they mentions following thing

The versions listed here represent the rules that NuGet uses to determine whether a given .NET Standard library is applicable. While NuGet considers .NET Framework 4.6.1 as supporting .NET Standard 1.5 through 2.0, there are several issues with consuming .NET Standard libraries that were built for those versions from .NET Framework 4.6.1 projects. For .NET Framework projects that need to use such libraries, we recommend that you upgrade the project to target .NET Framework 4.7.2 or higher.

Any idea what issues they are talking about here? (highlighted in bold above)

like image 258
Pankaj Kapare Avatar asked Jan 10 '20 21:01

Pankaj Kapare


People also ask

Can you convert .NET Framework to .NET Core?

You can migrate your old project to the Core project using the 'dotnet migrate; command, which migrates the project. json and any other files that are required by the web application. The dotnet migrate command will not change your code in any way.

Should we migrate from .NET Framework to .NET Core?

Microsoft has made tremendous advancements in its cross-platform, open-source . Net Core, which is why there are many reasons to migrate from the classic . Net Framework. 124,934 active websites using ASP.NET Core; additionally, 51,043 sites used it historically.

What benefits .NET Core brings to project compared to .NET Framework?

NET Core focuses to develop apps in a variety of domains like gaming, mobile, IoT, AI, etc. . NET Framework is limited to window OS. Mobile.NET Core is compatible with various operating systems-Windows, Linux, and Mac OS.


1 Answers

While .NET Framework 4.6.1 technically supports .NET Standard 2.0, there were some inadvertent omissions from 4.6.1 that means it doesn't actually support the full Standard 2.0 API surface without additional NuGet packages. This was only corrected in Framework 4.7.2.

Hence if you're looking to migrate to Core, it's safest to first migrate your code to Framework 4.7.2. That way any of the "patch" NuGet packages, that aren't necessary in Core/Standard (and will actually cause problems if present), will no longer be present.

Libraries that are built in versions of Framework before 4.7.2 will also pull in these additional packages, with the same results. But if your code is on 4.7.2 then the built-in APIs will be used, again making the extra packages unnecessary.

like image 184
Ian Kemp Avatar answered Oct 22 '22 10:10

Ian Kemp