Error running Add-Migration Setup

Asked

Viewed 88 times

0

When executing the command Add-Migration Setup for the creation of the table in SQL Server in PM the message below occurs even if I reference the api project with Shared. The system even processes something, but soon gives this error.

No Dbcontext was found in Assembly 'Youlearn.Api'. Ensure that you’re using the correct Assembly and that the type is neither Abstract nor Generic.

Follow the link from the solution

  • Hello Celio, it is recommended to leave error messages in text form in your question and not image.

  • @Davidalves Corrected, thank you.

  • 1

    Have you set your context in the project that is trying to run the command? Look at my example: <connectionStrings>&#xA; <add name="EFContexto" connectionString="Data Source=(LocalDb)\MSSQLLocalDB;Initial Catalog=AgilManager;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\Agil.mdf" providerName="System.Data.SqlClient" />&#xA; </connectionStrings>

  • My response helped?

  • Hi Renan. Your answer helped me yes. After following your suggestion I still found another error corresponding to the lack of a constructor not created. Everything worked out, thank you!

1 answer

0

As your RU context class (YouLearnContext) is in ddd-net-core/Youlearn.Infra/Persistence/EF/, then when executing the command Add-Migration Setup you have to select the project Youlearn.Infra.

inserir a descrição da imagem aqui

Browser other questions tagged

You are not signed in. Login or sign up in order to post.