Use Entity Framework in .net 4.0 with Oracle database - possible? - c#

I am building an application that targets .Net 4.0 (cannot be higher for the moment). I need to get access to Oracle Db (11g) and I wanted to use Entity Framework.
To be able to do that I know that I have to use:
Oracle.ManagedDataAccess
Oracle.ManagedDataAccess.EntityFramework
The first one is no problem, however when I try to install the Oracle.ManagedDataAccess.EntityFramework NuGet package, I get the following message:
Could not install package 'Oracle.ManagedDataAccess.EntityFramework
12.1.2400'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.0', 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.
When I change target framework to 4.5.2 the package installs and everything works fine so I am assuming that this package is somehow dependent on .Net framework ~4.5.
Is there any workaround to make it work with .Net 4.0?
Edit:
Just to be clear, I have instaled Entity Framework 6.1.3 as this is prerequisite for installing Oracle's EF provider

Oracle.ManagedDataAccess.EntityFramework has a dependency to EntityFramework (>= 6.0.0 && < 7.0.0) so you can install first Entity Framework 6.1.3 from nuget that version works on .Net Framework 4.0 and then Oracle.ManagedDataAccess.EntityFramework

I had the same problem, and found that Oracle.ManagedDataAccess.EntityFramework 12.2.1100 it was built for .net 4.5.
Assembly explorer screenshot
So, I believe that we can not use Oracle.ManagedDataAccess.EntityFramework 12.2.1100 with .net 4.0.
upd:
I received the explanation of that situation from Oracle .NET Team:
From: "Oracle .NET Team"
Date: 16 августа 2017 г., 0:58:31
Theme: Reply: [NuGet Gallery] Message for owners of the package 'Oracle.ManagedDataAccess.EntityFramework'
Hi Yuriy,
Microsoft desupported .NET Framework 4 support for versions 4.5.1 and
earlier as of January, 2016. In the newest ODP.NET release, Oracle
follows that support policy.
Oracle did not change ODP.NET such that
it only works in .NET 4.5.2 and newer versions. Microsoft did not
change .NET that prevents backwards compatibility. It's actually
likely that the new ODP.NET will work fine with the older .NET 4
versions. I'm not aware of any incompatibilities. Oracle just doesn't
officially support nor certify the earlier .NET versions anymore.
Regards, Oracle .NET Team

Related

Build Error after Upgrading microsoft.net.sdk.functions

My project uses .net framework 4.8. After upgrading microsoft.net.sdk.functions from version 1.0.24 to 3.0.1, the build on my local machine works fine, but there are some errors on the build on VSO pipeline:
microsoft.net.sdk.functions\3.0.1\build\microsoft.net.sdk.functions.build.targets(41,5):
It was not possible to find any compatible framework version
The specified framework 'Microsoft.NETCore.App', version '3.0.0' was
not found
microsoft.net.sdk.functions\3.0.1\build\microsoft.net.sdk.functions.build.targets(41,5):
metadata generation failed.
There is no version 3.0.0 for Microsoft.NetCore.App nuget package. Why would the error ask for that version? Also how can I fix the error?
Looking at the package on NuGet, version 3.0.1 is intended for use with .NET Core 3.0 and higher applications, not .NET Framework applications. Version 1.0.38 appears to be the latest version with .NET Framework support (4.6 and higher).

Webdriver Driver Mananger 2.7.0 not getting installed from Nuget with .Net framework 4.5

I want to use WebDriverManager in my code when I am trying to install the reference from the Nuget Package Manager I get an error.
I have tried updating and degrading the .Net framework.
Can we use WebDriverManager 2.7.0 with .Net framework 4.5?
Error Message seen is :
Could not install package 'WebDriverManager 2.7.0'. You are trying to install this package into a project that targets '.NETFramework, Version=v4.5', 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.
I know this post is old but I ran into the same issue today and was able to figure it out. You need to install version 2.2.7 instead. WebDriverMangaer version 2.2.8 and above require .Net Standard 2.0 which is only compatible with .NET Framework 4.6.1 and above.

Building .NET 4.0 project on Windows server 2016, Window 10

We recently need to upgrade our build server from Windows server 2008 to 2016. Because 08 is fading out
As we all know, Windows Server 2016 is installed with .NET Framework 4.6 and from https://learn.microsoft.com/en-us/dotnet/framework/install/on-windows-10
You can only have one version of the .NET Framework 4.x installed on your machine.
You cannot install an earlier version of the .NET Framework on your machine if a later version is already installed.
The case is, we have many projects using
.NET 4.0 with EF 4.4.0.0
.NET 4.5 with EF 5.0.0.0
And some classes such as System.ComponentModel.DataAnnotations.Schema.ColumnAttribute had moved from EF to .NET from EF 4.4.0.0 to .NET 4.5 along the upgrade.
Therefore, missing .NET 4.0 results in:
error CS0433: The type
'System.ComponentModel.DataAnnotations.Schema.ColumnAttribute' exists
in both ...\workspace\....\EntityFramework.dll and
...\Windows\Microsoft.NET\assembly\GAC_MSIL\System.ComponentModel.DataAnnotations\v4.0_4.0.0.0__31bf3856ad364e35\System.ComponentModel.DataAnnotations.dll'
because it trys to use .NET 4.5 with EF 4.4.0.0.
My question is: we don't have resources to ask QA teams to have a full test on every aspects of our applications, but we do need to use the new build server. Do you guys have any other idea / thought thats worth trying so that the it can build?

How to update to .NETStandard 2.0 NuGet Package

I've a good old .NET Framework 4.7 Class Library in Visual Studio 2015 currently using Microsoft.Extensions.Configuration NuGet package version 1.1.2. I'm trying to update this to version 2.0, but I'm getting this error:
Microsoft.Extensions.Configuration 2.0.0'. You are trying to install
this package into a project that targets '.NETFramework,Version=v4.7',
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.
I see that the new version only supports .NETStandard 2.0. Do I have to convert all my project to either .NET Core or .NET Standard in Visual Studio 2017?
.NET Framework versions 4.6.1 and higher do support .NET Standard 2.0+, but only when using new tooling. Make sure you update to VS 2017 version 15.3.0 or higher and have the .NET Core SDK 2.0.0 installed and no global.json in your solution's directory hierarchy pinning a lower SDK version.
You may also need to install the .NET Core workload in VS 2017
Yes you have to convert your project to .Net standard 2.0 to use the Microsoft.Extensions.Configuration 2.0.0 package.
Check out the below link for .Net standard 2.0 supported .Net framework version
as of now the, .Net standard 2.0 supports only up to .Net framework 4.6.1
.Net standard 2.0 supported api

can not upgrade from EF Core 1.1.2 to version 2.0.0

All, I recently started working on a project that uses EF Core 1.1.2. I saw where 2.0 was released because I started getting errors when I tried to add EF core to a project.
I couldn't update the existing project, I created a brand new console project. Set the .Net framework to 4.6.1 and still had no luck. I always get the following message. Has anyone ran into this issue? thanks in advance
Install-Package : Could not install package 'Microsoft.EntityFrameworkCore.SqlServer 2.0.0'. You are trying to
install this package into a project that targets '.NETFramework,Version=v4.6.1', but the package does not contain
any assembly references or content files that are compatible with that framework.
EF Core 2.0 release has been officially announced and the documentation is (partially) updated.
Of course it's not NET Core only. But the actual prerequisites for targeting Full .NET Framework are as follows:
(1) Project targeting .NET Framework 4.6.1 and above.
(2) Visual Studio 2017 with (important!) 15.3.0 update (also just released) installed
Before updating the VS I was getting the same error. After updating the error is gone and EF 2.0 package is successfully installed.
EF Core 1.1.2 had a dependency on .NETStandard 1.3 or .NETFramework 4.5.1. So as you were targeting .NetFramework 4.5.2 everything is hunky dory.
EF Core 2.0 has a dependency on .NETStandard 2.0. This is not compatible with the .NETFramework, everything is far from hunky dory.
According to the source below you can get .NetFramework support with 2.0 tooling, which is in preview:
https://dotnet.myget.org/feed/dotnet-core/package/nuget/NETStandard.Library.NETFramework
The alternative would be to migrate your application so it doesn't use the .NetFramework but only targets .NETStandard libraries.
Sources
https://www.nuget.org/packages/Microsoft.EntityFrameworkCore.SqlServer/2.0.0
https://www.nuget.org/packages/Microsoft.EntityFrameworkCore.SqlServer/1.1.2
https://learn.microsoft.com/en-us/dotnet/standard/net-standard
Good luck.
EntityFramework Core 2.0.0 is not compatible with a Target framework other than Core 2.0.0. You will need to ensure your project is targetting this and install any dependancies.
It will NOT work with the (standard) .NET framework versions, it is a 'Core' specific release.

Categories

Resources