vivanov vivanov - 5 months ago 206
ASP.NET (C#) Question

Can't use oracle managed driver in ASP.NET Core 1 app

I am trying to move from ASP.NET Core RC1 to 1.0.0-preview2 but having problems using Oracle managed driver that was working before. I am getting a following error trying to create a new OracleConnection:

Error CS0012 The type 'DbConnection' is defined in an assembly that is
not referenced. You must add a reference to assembly 'System.Data,
Version=, Culture=neutral,
PublicKeyToken=b77a5c561934e089'. Ludens.Data..NETCoreApp,Version=v1.0
16 Active

Here is a code where I use it:

using System;
using Oracle.ManagedDataAccess.Client;
using Microsoft.Extensions.Options;
using Ludens.Common;
using System.Data;

namespace Ludens.Data
public class LegacyContext : IDisposable
public IDbConnection Connection { get; }

public LegacyContext(IOptions<LudensSettings> options)
var appSettings = options.Value;
Connection = new OracleConnection(appSettings.Oracle.Connection);

public void Dispose()

Also here is my package.json:

"version": "1.0.0-*",

"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.0",
"type": "platform"
"Dapper": "1.50.0",
"Oracle.ManagedDataAccess": "12.1.24160419",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
"Ludens.Common": "1.0.0"

"frameworks": {
"netcoreapp1.0": {
"imports": [

I have a feeling that I incorrectly specify dependencies but figure out what I am missing. Please advice.


As was noted by @LexLi Oracle doesn't yet support .net core so you won't be able to target netcoreapp1.0.

However, if you're only targeting windows platform, you can simply target a supported .net framework:

"frameworks": {
  "net451": { }

This will at least allow you to develop in .net core, and when Oracle support does arrive, upgrading should just be a matter of amending your project.json.

Note, if you want to use the Entity Framework 7 against Oracle, this still won't work, you'll need to wait for a supported library.