EF Core Migration error: “Unable to create an object of type 'ApplicationContext'”


I'm trying to do the migration with EF Core but I get an error - how can I fix this error?

PM> add-migration ini

Unable to create an object of type 'ApplicationContext'. Add an implementation of 'IDesignTimeDbContextFactory' to the project, or see <a href="https://go.microsoft.com/fwlink/?linkid=851728" rel="nofollow">https://go.microsoft.com/fwlink/?linkid=851728</a> for additional patterns supported at design time.


This will also happen if you have multiple start-up projects - when migrating, just select one (in VS right click Solution and Set StartUp Projects...)


1.Modify your code in ConfigureService with :

options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection"), x => x.MigrationsAssembly("WebApplication"))); <ol start="2"><li>In command line which includes WebApplication.csproj:</li> </ol>

dotnet ef migrations add Init


  • Style messed up after nuget update.
  • How to make Windows DNS and WINS settings persist in an Azure VM?
  • Bluebird promise resolve(data) is undefined in client code
  • Why does transposing a DataFrame with strings and timedeltas convert the dtype?
  • TabControl caching with code behind layout changes
  • Nested iframe cross-domain communication
  • HTTPS request/response in Android
  • Why use 4096 elements for a char array buffer?
  • How to set the linear layout width in a HorizontalScrollView?
  • Two way one to one associations in Ember Data
  • Eloquent Javascript: Can't understand how the number value is determined in the sum function
  • Create my own classList object when the browser does not implement it itself
  • Setup SignalR and Service Bus inside a Azure Service Fabric service
  • Giving a model knowledge of a many-to-many related model in django
  • Zero downtime deployment Nodejs application
  • Does anyone know about Kephas?
  • ImportError with importing keras
  • Eclipse ADT Plugin crashed after updating to version 22.0
  • how to ignore files when finishing private ClearCase branch?
  • Cycle R,G,B vales as HUE?
  • Salesforce consuming XML and display data in Visualforce report
  • PHP Append to Excel file
  • React Current Image in Image Gallery
  • no endpoints available for service \\“kubernetes-dashboard\\”
  • Facebook like button redirect? [closed]
  • Combine two jagged lists into one
  • How can I do case insensitive string search with Linq and SQL Server?
  • Php artisan optimize is failing on production server
  • UIScrollView does not restore properly
  • Why do you need 2 Javascript files for cross-platform Cordova plugin?
  • trigger ontouch event programmatically
  • Unable to create Access token grant type in wso2 API manager store to test API
  • How to call different template for different category archive page in woocommerce