I do have my project which uses .NET Framework 4.7.2 and which is using .Net Standard 2.0. Inside net standard class library i want to use DbProviderFactories.GetFactory method. Nevertheless i read that DbProviderFactories is not available in .Net Standard 2.0 but it has been added to 2.1. The problem is .Net Framework 4.7.2 or even 4.8 cannot reference .Net standard 2.1. How to solve that?
I have a DLL(Say FileWrapper.dll) that is build using .Net Framework 4.5 (Build for linux)
Is it possible to build a console application (in .Net Core 2.2 - For Linux) that has references FileWrapper.dll and use various functions within in FileWrapper.dll.
Any pointers or past experience is helpful.
Building .net core 2.2 console app for Linux using dll build in .Net Framework 4.5
No Code specific
Hoping to build .net core console app that uses a dll build in .net framework 4.5
Yes, this is possible and was introduced with the .NET standard 2.0 which is supported by .Net Core 2 and .Net Framework 4.6.1. The concept is described is called a "compatibility shim" in .Net Standard 2.0. Here are a couple of links to get you started
Building a Compatibility Shim with .Net Standard 2.0
stack overflow - Compatibility shim used by .Net Standard 2.0
I'm building an ASP.NET Core Web API project. I will be heavily using EF Core with the connection with SQL Server. I want to organize the project around 3 main tiers: Core/Logic/Domain, Data/Infrastructure and Web/API.
Web/API will be definitely a .NET Core project, but I'm struggling with the decision whether Core and Data projects should be .NET Core library or .NET Standard library.
My question is, will I lose any features or anything while building my data persistence in .NET Standard library?
For a class library, the target framework simply specifies a compatibility layer. The ultimate functionality comes from the target framework of the project that references the class library.
For example, let's say that you create a .NET Standard library, and then you include that in a .NET Framework project. Everything you do happens on .NET Framework, and for all intents and purposes you could've targeted .NET Framework from your class library as well. The choice of .NET Standard simply says that you're going to use APIs from some .NET Standard-compliant target. That's all. As a result, the functionality of something like EF Core, ultimately depends on what you drop the library into, not what framework your library targets.
As to whether to choose .NET Standard or .NET Core as the target framework for your library, simply: use .NET Standard unless you have a good reason not to. If you target .NET Standard, you can drop it into any project that targets any framework that is compatible with the version of .NET Standard your library targets. If you choose .NET Core, you can only use the library in .NET Core projects.
Things get a little murkier when you start looking at .NET Core 3.0, though. You can technically target .NET Standard 2.1 and get all the goodness of .NET Core 3.0, but nothing but .NET Core 3.0 actually supports .NET Standard 2.1. You can target .NET Standard 2.0, but then you're stuck with .NET Core 2.2. In other words, if you want to use .NET Core 3.0, right now, there's no functional different between choosing .NET Standard 2.1 or .NET Core 3.0 as the target framework of your library. In either case, it will only work in .NET Core 3.0 projects.
Adding even more confusion, Microsoft is moving the next version of everything under the .NET 5 umbrella. What becomes of .NET Standard at that point hasn't been discussed, by I'd imagine it largely goes away. Once there's a .NET 5, any project can target .NET 5 and be used by any other project that targets .NET 5. That's still a ways off, though. The reason I bring it up, is that if you want to use .NET Core 3.0 today, there's not much point in targeting anything but .NET Core 3.0. Most of the stuff in .NET Standard 2.1 is not back-portable to things like .NET Framework and Unity, so those will never be on .NET Standard 2.1. The path forward for those frameworks is making them .NET Core compatible, to eventually end up with .NET Core 4.0, which Microsoft will call .NET 5.
Long and short, the best performance and features are with .NET Core 3.0, as long as you can go 100% .NET Core 3.0, then that's what you should target. If you need to use your library in something like an Xamarin or .NET Framework app, then stick with .NET Standard 2.0.
From the .NET Standard Microsoft Docs
The .NET Standard is a formal specification of .NET APIs that are intended to be available on all .NET implementations.
From the .NET Core Microsoft Docs
.NET Core is an open-source, general-purpose development platform
What this means in relation to your question.
Creating a .NET Standard library, you would be able to pull that library into a .NET Core project or a .NET Framework project assuming that the .NET Core/Framework project would adhere to the same .NET Standard version of your library or greater. So, the .NET Standard library would give you more flexibility regarding the projects you would be able to pull that library into(good if this needs to be pulled into legacy applications running on .NET Framework >=4.6.1 as well as new applications that would be written in .NET Core).
The only hiccup I've encountered with this approach is regarding migrations. If you want to use EFCore Migrations through the dotnet ef commands, it expects you to target a project with a .NET Core version. So, if you create your DbContext in the .NET Standard library and want to create migrations from it, you will either have to give it a startup project that is a .NET Core project or implement a 'Design-time DbContext Creation'. As an aside, this last option does have a few limitations, one of which is documented in an issue on GitHub.
I am porting a project from .net framework to .net core. For that I created a new .net core (2.2.0) and adding files. In the .net framework I have using Microsoft.Xrm.Sdk.Query library and I could not find it in .net core. I am new to .net framework and .net core the nearest I could find is in this post
https://github.com/dotnet/core/issues/604
I want to know what would be the possible option to implement this in .netcore.
Is it possible to have a .NET core 1.1.4 app run on .NET standard 2 or would .NET core 2.0.9 be required?
No, .NET Core 1.x only supports libraries targeting netstandard1.x.
You'll need to install some version of .NET Core 2 to support libraries targeting netstandard2.0.
The .NET Standard documentation has a table of which platforms support which versions of .NET Standard, and it shows .NET Core 2.0 as the lowest version of .NET Core that supports .NET Standard 2.0.