Install nuget package : EntityFramework 6 in .NETStandard 2.0 class library - entity-framework-6

I installed nuget package: EntityFramework 6 in .NET Standard2.0 Class library. On building the project I am getting the below warning message:
NU1701:Package 'EntityFramework 6.2.0' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETStandard,Version=v2.0'. This package may not be fully compatible with your project.
Does it mean that we cannot use EntityFramework 6 in .NETStandard 2.0 class library?
Can anyone help me here by providing their inputs

[...]. This package may not be fully compatible with your project.
Entity Framework 6 will be compatible with a project that target .NET Framework but will not be compatible with a project that target .NET Core
The answer is yes, you can use EF6 with .NET Standard 2.0 class library as long as you plan to only support .NET Framework
Microsoft already announced they plan to release a version of EF6 that support .NET Core at the end of 2019.
Disclaimer: I'm the owner of the project Entity Framework Classic
Entity Framework Classic is an EF6 fork. It's everything you like about EF6, but with better performance, must-have features, .NET Core support, and more.
It's currently the only option available to use a EF6 fork on a project that target NET Core
There is a free Community version that includes pretty much everything and an Enterprise version that include additional features.

Related

I cannot change the Target Framework from .NET 5.0 to .NET 4.8 for a C# .NET Framework Class Library in Visual Studio 2019

I am trying to build a .NET 4.8 Class Library that I can make COM-Visible as a support library from an Access application.
There are no prompts for the version of .NET Framework when I create the solution.
When I look at the Project Properties, the .NET Framework is set to 5.0.
Although I have the .NET Framework 4.8 installed, it does not appear in the combo-box for the Target framework. The only options are shown below.
I have also noticed that the Startup object combobox does not reflect the selected startup assembly.
Do I need to drop back to Visual Studio 2017 to create a .NET Framework 4.8 library?
Which SDK is installed?
If you only have the .net 5 SDK installed, it might suffice for making a .net core 3 app but it will not cover .net Framework.
Install the .net Framework SDK for the version you want to target.
And/or install a targeting pack if you want to target .net 4.8 and 4.7.2 for example.
(Maybe helpful: What's the difference between the .NET Framework SDK and the Targeting pack)
This happened to me because I had choosen the wrong kind of project.
I had choosen a project library for C#, Windows Linux, macOS.
By this the same thing, that one could only had .NET 5.0 and higher as Framework.
I had to create a new library project with only C# and Windows.
Than I could choose all installed .NET frameworks

How to create a C# version 9.0 Application with Visual Studio 2019

I am trying (unsuccessfully) to create a Console Application that targets .Net 5.0 so that I can use C# Version 9.0.
Although I have installed the .Net 5.0 I am unable to select it when creating a project.
I would like to use some of the new features of C# 9 but this requires version 5.0 of .Net as I understand it.
I am using Visual Studio 2019 Version 16.8.3
Thanks
Right click on the csproj and make sure it looks like this:
<PropertyGroup>
<OutputType>Exe</OutputType>
<LangVersion>latest</LangVersion>
<TargetFrameworks>net5.0</TargetFrameworks>
...
</PropertyGroup>
If you don't see .NET 5 in the Target Frameworks for a .NET Core Application, you don't have the installation correct. Here's what mine looks like
C# 9 is only available on .NET 5 (which is .NET Core not .NET Framework).
C# 9.0 is supported only on .NET 5 and newer versions.
https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/configure-language-version
.NET 5.0 is the next major release of .NET Core following 3.1. We
named this new release .NET 5.0 instead of .NET Core 4.0 for two
reasons:
We skipped version numbers 4.x to avoid confusion with .NET Framework
4.x.
We dropped "Core" from the name to emphasize that this is the main implementation of .NET going forward. .NET 5.0 supports more
types of apps and more platforms than .NET Core or .NET Framework.
https://learn.microsoft.com/en-us/dotnet/core/dotnet-five

.Net Core Vs .Net framework to create a new mvc web application

I have visual studio 2015 professional editton, and i want to create my first MVC web application which should be a .net core. now i am watching an online learning demo, which mentioned to create this project:-
while inside my visual studio i have these options:-
so which option i need to chose?
second question, how i can be sure that i am using the latest version of MVC?
Thanks
First, there is no such thing as MVC 6. It's ASP.NET Core. Second, the decision of whether to use .NET Core or .NET Framework comes down to what you need to do. .NET Core is cross-platform (Windows, Mac and Linux), whereas .NET Framework is Windows-only. .NET Core is also lighter weight, faster, and has a number of new CLR features, compared to .NET Framework. Virtually the only reason to use .NET Framework is if you have a dependency on something that utilizes Windows-specific APIs, meaning it can't be run cross-platform. Otherwise, you should always use .NET Core, if you can get away with it.
ASP.NET Core is really just a collection of NuGet packages, and like other NuGet packages, they can be updated easily. However, the difference is that these NuGet packages are generally tied to a particular version of .NET Core, and thus, the appropriate version of the packages are installed based on which version of .NET Core you're targeting. For example, if you're targeting netcoreapp2.2 then you'll see that that packages like Microsoft.AspNetCore.App will be brought in with versions like 2.2.x.
So, to answer your question about staying up to date, it essentially entails installing the latest version of the .NET Core SDK, and then changing your project to target that new version. Then, all the ASP.NET Core NuGet packages will naturally update accordingly.

How is it possible to use OData in .net core application?

According to docs (http://odata.github.io/WebApi/#11-01-OData-V4-Web-API-Scaffolding) it is required to inherit from ODataController.
I have installed package using nuget and still not able to inherit from that class.
Does OData support .net core? Are docs obsolete?
A possible duplicate of OData Support in ASP.net core
The docs link that you mentioned is targeting .NET Framework. For .NET Core support, please download the Microsoft.AspNetCore.OData NuGet Package from
https://www.nuget.org/packages/Microsoft.AspNetCore.OData
This package has a dependency on Microsoft.OData.Core which will also get installed automatically. Starting from version 7.2.0 the package is targeting .NET Standard 1.1.
Once the package is referenced, You should be able to inherit from ODataController. For further details please refer to the following video and links
https://www.towfeek.se/2017/01/08/odata-with-aspnet-core/
http://odata.github.io/odata.net/v7/#ODL-7.3.1
I hope this helps

F# .NET Standard Library Project

I have a Xamarin Forms solution, containing several F# portable class libraries.
In order to use the latest version (4.0.0) of Microsoft.Azure.MobileClient, I need to upgrade to FSharp.Core 4.2.1, but this appears to be incompatible with Profile 78:
Could not install package 'FSharp.Core 4.2.1'. You are trying to
install this package into a project that targets
'.NETPortable,Version=v4.5,Profile=Profile78', 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.
It is possible to use .NET Standard class libraries from Xamarin projects, but is it possible to create a .NET Standard class library in F#?
What is the best way forward here?
What the error message is telling you is that the project is targeting a PCL target. FSharp.Core 4.2.x does not have a PCL target anymore, and only contains .NET Framework and .NET Standard 1.6 binaries. Neither is compatible with the PCL target F# is using here.
The release notes for FSharp.Core were recently updated with developer guidance: https://www.nuget.org/packages/FSharp.Core/
This is the important bit for your project:
For existing packages targeting .NET Frameworks 4.0 or lower and PCLs, use FSharp.Core 4.1 or lower.
.NET Standard (as of this time) has not proliferated across all things .NET yet. As #Foole says, you can indeed create a .NET Standard class library with F# today. But it's not compatible with the rest of the .NET ecosystem until .NET Standard is fully supported on all flavors of .NET.
You can try to convert your Xamarin.Forms (and your F#) project from .NET Portable to .NET Standard 2.0, since both packages can be added to .NET Standard.
How to convert Xamarin.Forms to .NET Standard
Create new Xamarin.Forms project (skip for already created project)
Create new .NET Standard library project in the same solution
Add reference to Xamarin.Forms package
Copy your content from Xamarin.Forms shared project to the new library project
Change all references (from Android, iOS, UWP) to point to the library project instead of the shared project
Source: Xamarin Blog

Resources