{"record":{"id":"9f80472a42bf51c7","repo":"dotnet/efcore","slug":"unable-to-find-provider-assembly-assemblyname","errorCode":null,"errorMessage":"Unable to find provider assembly '{assemblyName}'. Ensure the name is correct and it's referenced by the project.","messagePattern":"Unable to find provider assembly '(.+?)'\\. Ensure the name is correct and it's referenced by the project\\.","errorType":"exception","errorClass":"OperationException","httpStatus":null,"severity":"critical","filePath":"src/EFCore.Design/Design/Internal/DesignTimeServicesBuilder.cs","lineNumber":169,"sourceCode":"        _reporter.WriteVerbose(DesignStrings.FindingProviderServices(provider));\n\n        Assembly providerAssembly;\n        try\n        {\n            providerAssembly = Assembly.Load(new AssemblyName(provider));\n        }\n        catch (Exception ex)\n        {\n            var message = DesignStrings.CannotFindRuntimeProviderAssembly(provider);\n\n            if (!throwOnError)\n            {\n                _reporter.WriteVerbose(message);\n\n                return;\n            }\n\n            throw new OperationException(message, ex);\n        }\n\n        var providerServicesAttribute = providerAssembly.GetCustomAttribute<DesignTimeProviderServicesAttribute>();\n        if (providerServicesAttribute == null)\n        {\n            var message = DesignStrings.CannotFindDesignTimeProviderAssemblyAttribute(\n                provider);\n\n            if (!throwOnError)\n            {\n                _reporter.WriteVerbose(message);\n\n                return;\n            }\n\n            throw new InvalidOperationException(message);\n        }\n","sourceCodeStart":151,"sourceCodeEnd":187,"githubUrl":"https://github.com/dotnet/efcore/blob/dbf9771522148d61a2467854921bd5dc6f6e6916/src/EFCore.Design/Design/Internal/DesignTimeServicesBuilder.cs#L151-L187","documentation":"Thrown by DesignTimeServicesBuilder when Assembly.Load(new AssemblyName(provider)) throws -- the configured database provider assembly (e.g. Microsoft.EntityFrameworkCore.SqlServer) could not be located/loaded at design time. EF needs the provider DLL to read its [DesignTimeProviderServices] attribute and wire up scaffolding/migration services. The inner exception carries the loader failure (FileNotFound, version mismatch, etc.).","triggerScenarios":"DbContext.OnConfiguring calls options.UseSqlServer (or UseNpgsql, etc.) but the provider NuGet package is not installed in the startup/entry project being used at design time. Build(context) walks providers, calls ConfigureProviderServices -> Assembly.Load(provider) which throws.","commonSituations":"Provider package installed only in the data project, not the startup project EF executes against; package was uninstall-cleaned; a version downgrade left a binding redirect gap; running dotnet ef from the wrong directory.","solutions":["Install the matching EF Core provider package into the STARTUP project: dotnet add package Microsoft.EntityFrameworkCore.SqlServer.","Make sure the same major EF Core version is used across all projects.","Run dotnet ef with --startup-project pointing at the project that has the provider reference.","Rebuild after adding the package so the assembly is present on disk."],"exampleFix":"// before: DbContext in Data project, no provider in Web project\ndotnet ef migrations add Init -p ../Data\n// after\n// (in Web project dir)\ndotnet add package Microsoft.EntityFrameworkCore.SqlServer\ndotnet ef migrations add Init -p ../Data -s .","handlingStrategy":"validation","validationCode":"// At startup, verify the provider assembly is loadable.\ntry { _ = Assembly.Load(providerAssemblyName); }\ncatch (Exception ex) { throw new InvalidOperationException($\"Provider assembly '{providerAssemblyName}' not loadable. Install the package.\", ex); }","typeGuard":null,"tryCatchPattern":"try { /* operation requiring provider */ }\ncatch (OperationException ex) when (ex.Message.Contains(\"Unable to find provider assembly\"))\n{ /* install Microsoft.EntityFrameworkCore.<Provider> in the startup project, rebuild, retry */ }","preventionTips":["Install EF Core provider packages in the STARTUP project, not just the data project.","Pin EF Core versions identically across all projects.","Add a CI step that runs 'dotnet ef dbcontext list' to catch missing providers early."],"tags":["efcore","provider","design-time","nuget","assembly-loading"],"analyzedSha":"dbf9771522148d61a2467854921bd5dc6f6e6916","analyzedAt":"2026-08-06T20:46:03.226Z","schemaVersion":2},"datasetVersion":"2026-08-07T03:17:09.362Z"}