Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scaffold-DbContext not working: Unable to find expected assembly attribute named DesignTimeProviderServicesAttribute #208

Open
danim-hub opened this issue Feb 21, 2021 · 0 comments

Comments

@danim-hub
Copy link

Describe the bug
Cannot run Scaffold-Dbcontext

To Reproduce
Create a new project with Microsoft.EntitFrameworkCore.Tools reference
In PackageManager console, run:
Scaffold-DbContext -Connection "Data Source=192.168.2.10;Port=3030;Database=mytestdb;Uid=testuser;Pwd=pa$$word" -Provider AdoNetCore.AseClient -Project MyProject -StartupProject MyProject
Build started...
Build succeeded.
System.InvalidOperationException: Unable to find expected assembly attribute named DesignTimeProviderServicesAttribute in provider assembly AdoNetCore.AseClient. This attribute is required to identify the class which acts as the design-time service provider factory.
at Microsoft.EntityFrameworkCore.Design.Internal.DesignTimeServicesBuilder.ConfigureProviderServices(String provider, IServiceCollection services, Boolean throwOnError)
at Microsoft.EntityFrameworkCore.Design.Internal.DesignTimeServicesBuilder.Build(String provider)
at Microsoft.EntityFrameworkCore.Design.Internal.DatabaseOperations.ScaffoldContext(String provider, String connectionString, String outputDir, String outputContextDir, String dbContextClassName, IEnumerable1 schemas, IEnumerable1 tables, Boolean useDataAnnotations, Boolean overwriteFiles, Boolean useDatabaseNames)
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.ScaffoldContextImpl(String provider, String connectionString, String outputDir, String outputDbContextDir, String dbContextClassName, IEnumerable1 schemaFilters, IEnumerable1 tableFilters, Boolean useDataAnnotations, Boolean overwriteFiles, Boolean useDatabaseNames)
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.ScaffoldContext.<>c__DisplayClass0_0.<.ctor>b__0()
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.<>c__DisplayClass3_0`1.b__0()
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action)
Unable to find expected assembly attribute named DesignTimeProviderServicesAttribute in provider assembly AdoNetCore.AseClient. This attribute is required to identify the class which acts as the design-time service provider factory.

Expected behavior
The Scaffold-DbContext should create my model and dbcontext from existing tables in the database

Environment

  • netcore 3.1
  • visual studio 16.8.4
  • Microsoft.EntityFrameworkCore 3.1.12
  • AdoNetCore.AseClient 0.19.2

Additional context
Add any other context about the problem here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant