Update-Database Error on switching from .Net core 1.1 to 2.0

Hello everybody,

today I want to share some strange behaviour that I faced. 

Recently I needed to switch from .Net core 1.1 web app to .Net core 2.0 app. 

I found over internet that simplest way to achieve it will be just opening project in Visual Studio 2017 and VS will switch your project by itself. I decided to give to such attempt a try. 

Initially all went fine. Visual Studio 2017 gave me very nice looking report which convinced me that life is easy and wonderful. Actually it said that project was switched to .Net core 2.0 with success.

Then I've tried to execute in package manager console Update-Database command. Unfortunately I've seen following error message:

An error occurred while calling method 'ConfigureServices' on startup class 'Startup'. Consider using IDbContextFactory to override the initialization of the DbContext at design-time. Error: This method could not find a user secret ID because the application's entry assembly is not set. Try using the ".AddUserSecrets(string userSecretsId)" or ".AddUserSecrets<TStartup>()" method instead.
No parameterless constructor was found on 'ApplicationDbContext'. Either add a parameterless constructor to 'ApplicationDbContext' or add an implementation of 'IDbContextFactory<ApplicationDbContext>' in the same assembly as 'ApplicationDbContext'.

After some research I found following proposal to apply:

instead of line 


use line 


and for my suprise Update-Database reported to me that it was successful. 

No Comments

Add a Comment