ODP.NET Core beta 1does not work in .NET Core WebApi project — oracle-tech

    Forum Stats

  • 3,716,133 Users
  • 2,242,960 Discussions
  • 7,845,840 Comments

Discussions

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

ODP.NET Core beta 1does not work in .NET Core WebApi project

b0a23a0e-ca48-4c40-bdc9-98b686747bd1
edited April 2018 in ODP.NET

Hi All,

I struggle making the latest ODP.NET Core beta 1 release working in a .NET Core 2, WebApi new project.  It all works well following the example on YouTube in a Console app but if I include a ref to the dll in a new .NET Core2 WebApi project I get the following error:

  1. System.IO.FileNotFoundException: 'Could not load file or assembly 'Oracle.ManagedDataAccess, Version=2.0.12.0, Culture=neutral, PublicKeyToken=89b483f429c47342'. The system cannot find the file specified

Also, the same issue occurs when I include the library in a .NET Standard 2 project – (this is really where I need it!!)

Any suggestions?

NOTE:

After creating many test projects it "all of a sudden worked" using a .NET Core 2 WebApi startup project which has a reference to a .NET Standard 2 project in which I reference the ODP.Net beta 1 dll.  "Fantastic !!" I thought and then added a NuGet package (signalR) that I need and BANG!, the same error occurred again.

I removed the NuGet signalR but still the above error comes up - even when I recreate the Core 2 WebApi and a brand new Standard 2 project ...   it simply doesn't work anymore - totally - full stop (only as a Console app).

3692011

Best Answer

Answers

  • Alex Keh-Oracle
    Alex Keh-Oracle Posts: 2,753 Employee
    edited February 2018

    I haven't been able to reproduce your issue on my own. Can you try two things for me?

    1. Package ODP.NET Core as part of the same VS solution as your ASP.NET Core project, not as a separate library. This SO thread explains more.

    2. Clean your solution, rebuild, and rerun.

    If those steps don't fix your problem, then can you attach your test case to this thread? Reproducing the error seems very specific to some detail in your project.

  • 2715094f-1be4-4267-8462-a78da31c85d8
    edited February 2018

    Hello,

          I Ported my ASP.NET MVC 5 project to .NEt Core 2.0 which is using ODP.NET dll. I downloaded and referenced nut i am getting "FileNotFoundException: Could not load file or assembly 'Oracle.ManagedDataAccess, Version=2.0.12.0, Culture=neutral, PublicKeyToken=89b483f429c47342'. The system cannot find the file specified."

    I manually referenced the ODP.NET 2.0 dll but still i am getting error. i tried cleaning ,rebuilding the project i still get the same error.

    Appreciate your quick response.

    Thanks,

    Sri

  • 2715094f-1be4-4267-8462-a78da31c85d8
    edited February 2018

    Never mind. i created small console app to test this. ODP.NET dll is working fine. I will see what is going on in my .net core app.

    Thanks,

    Sri

  • 19aad7d3-bc65-4c48-8ea5-29804cdfcdf9
    edited February 2018

    Hi,

    there is not a solution yet, currently the Oracle component has a bug, I use it with a Web API project, which has several layers, but apart from referencing it in the Data project, for this component to work I have to reference it too in the api web project, it is not the best solution but it has worked for me now.

    I hope this helps.

    regards

    Victor

  • Alex Keh-Oracle
    Alex Keh-Oracle Posts: 2,753 Employee
    edited March 2018

    The NuGet ODP.NET Core Beta 2 was released this week. I'm curious whether anyone experiences the FileNotFound Exception using the new beta.

  • 3692011
    3692011 Member Posts: 4
    edited April 2018

    Hello!

    I'm using ODP.NET Core Beta 2 with a web api project and I've the same problem.

    I've tryed on "Ubuntu/VS Code" and "Windows/VS 2017" with exactly the same result:

    "Could not load file or assembly 'Oracle.ManagedDataAccess, Version=2.0.12.0, Culture=neutral, PublicKeyToken=89b483f429c47342'."

    The problem is at runtime (compilation is ok).

    I only downloaded the library and used it. I didn't execute any install script or something... it could be the problem?

    Thanks!

    Pablo

  • 3692011
    3692011 Member Posts: 4
    edited April 2018

    Hello!

    Now I've tryed using NuGet and I could run the web api example.

    But I have this warning:

    "The package "Oracle.ManagedDataAccess 12.2.1100" was restored with ".NETFramework,Version=v4.6.1" instead of the target platform of the project ".NETCoreApp,Version=v2.0"

    I couldn't found any option to change the platform version.

    Thanks,

    Pablo

  • Alex Keh-Oracle
    Alex Keh-Oracle Posts: 2,753 Employee
    edited April 2018

    @Pablo

    You downloaded managed ODP.NET, not ODP.NET Core beta. The latest beta version shows up as "2.0.12.0" when you look at the reference properties in Visual Studio.

  • 3692011
    3692011 Member Posts: 4
    edited April 2018

    You're right. Sorry.

    Now, I've downloaded the correct version and it works fine!

    The only issue I've is that I have to use NutGet to add the reference. Otherwise I get "Could not load file or assembly.." when I run the solution.

    Thank you,

    Pablo

  • Alex Keh-Oracle
    Alex Keh-Oracle Posts: 2,753 Employee
    edited April 2018 Accepted Answer

    @Pablo

    You probably hit this .NET Core bug.

    https://stackoverflow.com/questions/43966687/asp-net-core-could-not-find-file-or-assembly-with-custom-assembly

    It's a known .NET Core issue. One way to workaround the issue, which is use NuGet as you've seen.

    3692011
  • 3692011
    3692011 Member Posts: 4
    edited April 2018

    Thank you @Alex!

    We have to use NuGet until that issue has been solved.

    Regards,

    Pablo

This discussion has been closed.