question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to find provider assembly with name Microsoft.EntityFrameworkCore.SqlServer. Ensure the specified name is correct and is referenced by the project.

See original GitHub issue

Steps to reproduce

  1. Create a class Library-.Net core
  2. Add Following Dependencies:
    "Microsoft.EntityFrameworkCore.Tools": "1.1.0-preview4-final",
    "Microsoft.EntityFrameworkCore.SqlServer": "1.1.0",
    "Microsoft.EntityFrameworkCore.SqlServer.Design": "1.1.0",
    "Microsoft.EntityFrameworkCore.Design": "1.1.0",

The issue

When performing Scaffold-Dbcontext towards a SqlServerDB like below, Microsoft.EntityFramework.SqlServer dll is not resolved… Scaffold-DbContext “Server={ConnectionString}” Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models -verbose

Exception message:
Stack trace:
Microsoft.EntityFrameworkCore.Design.OperationException: Unable to find provider assembly with name Microsoft.EntityFrameworkCore.SqlServer. Ensure the specified name is correct and is referenced by the project. ---> System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.EntityFrameworkCore.SqlServer, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
   at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
   at Microsoft.EntityFrameworkCore.Design.Internal.DesignTimeServicesBuilder.GetProviderDesignTimeServices(String provider, Boolean throwOnError)
   --- End of inner exception stack trace ---
   at Microsoft.EntityFrameworkCore.Design.Internal.DesignTimeServicesBuilder.GetProviderDesignTimeServices(String provider, Boolean throwOnError)
   at Microsoft.EntityFrameworkCore.Design.Internal.DesignTimeServicesBuilder.Build(String provider)
   at Microsoft.EntityFrameworkCore.Design.Internal.DatabaseOperations.ScaffoldContextAsync(String provider, String connectionString, String outputDir, String dbContextClassName, IEnumerable`1 schemas, IEnumerable`1 tables, Boolean useDataAnnotations, Boolean overwriteFiles, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Design.OperationExecutor.<ScaffoldContextImpl>d__22.MoveNext()
   at System.Collections.Generic.EnumerableHelpers.ToArray[T](IEnumerable`1 source, Int32& length)
   at System.Collections.Generic.EnumerableHelpers.ToArray[T](IEnumerable`1 source)
   at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.<>c__DisplayClass4_0`1.<Execute>b__0()
   at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action)
Unable to find provider assembly with name Microsoft.EntityFrameworkCore.SqlServer. Ensure the specified name is correct and is referenced by the project.

Further technical details

EF Core version: (found in project.json or packages.config) Operating system: Visual Studio version: (e.g. VS 2013 or n/a)

Project.json:

{
  "version": "1.0.0-*",

  "dependencies": {
    "Microsoft.EntityFrameworkCore.Tools": "1.1.0-preview4-final",
    "Microsoft.EntityFrameworkCore.SqlServer": "1.1.0",
    "Microsoft.EntityFrameworkCore.SqlServer.Design": "1.1.0",
    "Microsoft.EntityFrameworkCore.Design": "1.1.0",
    "NETStandard.Library": "1.6.1"
  },

  "frameworks": {
    "netcoreapp1.0": {
    },
    "netstandard1.6": {
      "imports": "dnxcore50"
    }
  },

  "tools": {
    "Microsoft.EntityFrameworkCore.Tools.DotNet": "1.0.0-preview3-final"
  },

  "buildOptions": {
    "emitEntryPoint": false,
    "preserveCompilationContext": true
  }

}

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:21 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
smitpatelcommented, May 15, 2018

@rowana16 - Microsoft.EntityFrameworCore.SqlServer this is spelling error. The correct name is Microsoft.EntityFrameworkCore.SqlServer. I tried your repro steps and upon providing correct provider package name, it works fine.

0reactions
JanisAndinscommented, Oct 27, 2021

I got this error as well, but… as smitpatel commented on May 15, 2018 that solution worked for me 😃 Have a great night coding 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to find provider assembly with name Microsoft. ...
Unable to find provider assembly with name Microsoft. ... SqlServer. Ensure the specified name is correct and is referenced by the project.
Read more >
Unable to find provider assembly with name Microsoft. ...
SqlServer, I get the error message: "Unable to find provider as. ... Ensure the specified name is correct and is referenced by the...
Read more >
The dotnet dbcontext Scaffold ef and ...
Unable to find provider assembly 'Microsoft.EntyFrameworkCore.SqlServer'. Ensure the name is correct and it's referenced by the project.
Read more >
Unable to find provider assembly with name Microsoft ...
Unable to find provider assembly with name Microsoft.EntityFrameworkCore.SqlServer. Ensure the specified name is correct and is referenced by the project.
Read more >
Unable to find provider assembly with name Microsoft. ...
I was getting this error: Unable to find provider assembly with name Microsoft.EntityFrameworkCore.SqlServer. Ensure the specified name is correct and is ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found