Background
I am currently facing the problem that my ASP.Net Core 5.0 Application is suddenly required to use a special library (from an external provider) for communicating with a database. Unfortunately, this library targets Framework 4.7.2.
An upgrade of the library to .Net Core/Standard is not realistic in the near future.
Therefore, my idea was to write a wrapper with the following structure:
Application Type: Worker Service ↔ Standard library ↔ Framework library
Target Framework: .Net Core 5.0 ↔ .Net Standard 2.0 ↔ Framework 4.7.2
For test purposes, I used a Worker service instead of an ASP.Net web application. The Framework library references the said library, which is not available for .Net Core.
Problem
At first, I had the error:
Could not load file or assembly 'System.Configuration.ConfigurationManager’
but I solved it by loading the NuGet package in the Standard library. Now I run into the same Problem with another assembly:
Could not load file or assembly 'System.Data.OracleClient, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
Unfortunately, the OracleClient package is deprecated and no NuGet package is available for the Standard library. So, the solution from before is not valid anymore.
Attempted Solutions
I tried to use Oracle.ManagedDataAccess but to no avail.
I think the chosen versions should be compatible but I have also tried this (in different combinations):
- Instead of .Net 5 → .Net 3.1
- Instead of .Net Standard 2.0 → .NetStandard 2.1
- Instead of .Net Framework 4.7.2 → .Net Framework 4.6.1
Questions
- Am I wrong about the versions of the targe frameworks being compatible?
- I do not understand where exactly it is necessary to load the NuGet Packages. I thought it sufficient to reference them in the Framework library. But in case of the ConfigurationManager I had to reference the package in the Standard library.
- Is there any way to use a Framework library which references System.Data.OracleClient in a .Net 5 application or a .Net Standard library?
I am close to giving up but then I would have to downgrade my Web App to Framework, which would require a lot of useless work.