Can't install Microsoft.EntityFrameworkCore.SqlServer for a .NET 4.7.2 Framework project - visual-studio

I have a VB.NET Windows Forms project targeting the .NET Framework 4.7.2:
I am trying to install Microsoft.EntityFrameworkCore.SqlServer of which the latest stable version is 5.0.8:
However after clicking install and accepting all terms I get an error:
Could not install package 'Microsoft.EntityFrameworkCore.SqlServer 5.0.8'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.7.2', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.
Does anyone know what the heck its moaning about version for?

Does anyone know what the heck its moaning about version for?
EF Core 5 requires .NET Standard 2.1. .NET Framework only supports .NET Standard 2.0. So it will never work.
EF Core 3.1 is the last version to support .NET Standard 2.0, and so it's the last version of EF Core compatible with .NET Framework.
But .NET Core 5 supports Windows Forms.
So the options are:
upgrade everything to .NET Core 5
downgrade EF Core to version 3.1
switch from EF Core to EF 6, which is mature, stable and supports .NET Framework

Related

AuthorizationFactory.GetAuthorizationProvider in .NET Core / Net standard

I'm trying to migrate a C# enterprise library-dependent project (.Net framework 4.8) into .NET Standard. I see there are EnterpriseLibrary NuGet package versions available for .Net Core
e.g.
EnterpriseLibrary.Caching.Cryptography.NetCore
EnterpriseLibrary.ExceptionHandling.NetCore
EnterpriseLibrary.Common.NetCore
However, I'm unable to find matching NuGet packages for some packages.
e.g.
Enterpriselibrary.Security I don't find an equivalent version in .NET Core
I have one of the methods AuthorizationFactory.GetAuthorizationProvider in .NET4.8 is there any equivalent replacement in .NET Core/Net Standard?

how to resolve target .NET Framework with Xamarin

i am new to development with Xamarian platform.Now i just want to run application to targetFramework 4.5. but there diff targetframework listed as below. how i resolve that please help me out.
See https://learn.microsoft.com/en-us/dotnet/standard/net-standard - in the table, note that .Net Framework 4.5 supports the newer net-standard up to 1.1. So choose .NET Standard 1.1. Or if you can require .Net Framework 4.5.1 and newer, choose .NET Standard 1.2.
Or better, whatever dependency is forcing you to use Framework 4.5, talk to the vendor, get them to rebuild for .NET Core 3.1 or the new .NET 6.
If you really must support .Net "Framework" APIs, see https://learn.microsoft.com/en-us/archive/msdn-magazine/2017/connect/net-introducing-the-windows-compatibility-pack-for-net-core, for a (no longer being updated) solution that allows your newer code to be "Net Core", yet work with legacy .net APIs.
Be aware all this is "legacy" - Microsoft's goal is to move everyone to .NET 6.

What Non-4.* .NET App Versions play well with Standard?

I am building an MVC Web API (Service) with Views returned in specific cases. As an architectural decision, I've been directed to NOT build the service project in .NET Framework 4.*. Rather, I am to attempt .NET 5.0 first, and then Core 3.1 if 5.0 doesn't work.
This service project in my solution will depend on a few class library projects, call them DataLibrary, ComplexLibrary, and DocLibrary. DataLibrary will depend on a Nuget package of Oracle, be it ODP or Oracle Managed Data, in order to query an Oracle database via an Oracle Package on that database. DocLibrary will depend on a Nuget package of Aspose Word & Aspose PDF. ComplexLibrary will depend on Oracle AND Aspose.
Here's my dilemma:
Aspose Word's latest stable release (21.6) will report that it is compatible with 5.0 and Standard 2.0, but not .NET Core.
Oracle Managed Data reports that it is compatible with Standard 2.1 or Standard 2.0, but not 5.0 or .NET Core.
My own libraries have reported that they are not compatible with my API .csproj if...
3a. The API is 5.0 and the libraries are .NET Core or .NET Standard
3b. The API is Core 3.1 and the libraries are .NET Standard.
Since my compile script naturally requires a run of Nuget to retrieve all the necessary dependencies, I cannot get a clean compile because I seemingly have no combination of versions for my WebAPI and libraries that satisfy each others' compatibility needs. Since Standard libraries are the only common .NET version that satisfy the needs of both Aspose & Oracle, What available version for my WebAPI (i.e. I don't believe that Standard is an option for anything other than a class library) is compatible with .NET Standard libraries?
Thanks.
Please see the following article https://learn.microsoft.com/en-us/dotnet/standard/net-standard.
.NET Standard is not a framework it is kind f specification and .NET Core, .NET 5, Mono framework etc are .NET Standard implementations.
So for library projects I would select .NET Standard and for the service .NET Core or .NET 5 (which is actually the next version of .NET Core)
Well, don't I feel silly.
Turns out, the issue wasn't incompatibilities within Aspose, Office, .NET Core, 5.0, and Standard, but a failure of a prior version of NuGet to handle the different versions.
While my VS 2019 install was able to compile the whole solution effectively, my local install of NuGet was not. This was due to VS2019 likely using the most up-to-date version as of this post (5.9.#), while my locally installed version was 4.9.#. Thus, VS was able to sail through while my compile script kept failing at the NuGet stage (which I have included prior to the actual compile.) Once I ran a NuGet update, everything was good to go.
Long story short: KEEP YOUR NUGET VERSION UP-TO-DATE!!!

How to upgrade core 2.1.1 to core 2.2.3

The official documentation does not work.
Do I need VS 2017 Preview?! Or to restart my pc every time I install "Latest stable 2.2.3" SDK's? Perhaps its not so stable? Should I try 2.2.1 lol
VS 2015 will work up for up to .NET Core 1.1 (now EOL). VS 2017 will work for up to .NET Core 2.2. .NET Core 3.0+ requires VS 2019.
It's not clear what your exact issue is, but the process is basically this:
Download the appropriate .NET Core SDK version. Be careful because the SDK version is somewhat independent of the .NET Core version. Pay attention to specifically what version of .NET Core the SDK supports, not the version number of the SDK itself.
Edit your project file and change the target to the new .NET Core version. This will be the minor version, not patch releates. In other words, for any .NET Core 2.2.X, you'd use netcoreapp2.2 as your target.
That's it. After you save, any NuGet dependencies of your project, such as Microsoft.AspNetCore.App will update to the latest version within that target, i.e. 2.2.X. However, note that some packages may not always have new versions. Most of the major parts of ASP.NET Core, for example, change enough with each version that the NuGet packages get bumped as well. However, it is possible that you may still use a 2.1.X package if nothing changed in that for 2.2. In any case, you'll be able to see in Visual Studio if it's fully updated or not.

Is there a way to use enterprise library in .NET Core 1.1.2 web api

I am planning to use Enterprise Library for database access on a Web API project which is going to be built using .Net core app.
But I am unable to install Enterprise library using NuGet as the latest version of Enterprise Library is not compatible with.Net core app framework.
Note, I don't want to use Entity Framework.
Appreciate if the community can help on this.
If you can migrate your application to .Net Core 2.0 which is still in preview mode, but Microsoft promised to release it by Q3 2017, I have forked out the Enterprise Library project and ported that to .Net Core 2.0 which you can find it under this repository:
https://github.com/Chavoshi/EnterpriseLibrary.NetCore
And also this is the Nuget package for Data Application Block:
https://www.nuget.org/packages/EnterpriseLibrary.Data.NetCore
Still there are some missing parts such as OdbcFactory and OleDbFactory which they are not available in .Net ported APIs (Or Nuget package is not published yet), but I am keep working on them to maybe port them by myself or update it since the API will be available. I appreciate anyone who can contribute on this project as well. :)

Resources