This error appears to me. I use .NET 8. The project is divided into three layers. The presentation layer is a web project. The rest of the layers are class libraries. I installed the necessary libraries, all of which are version 8.

saleh salem 0 Reputation points
2024-07-16T20:30:25.5766667+00:00

Screenshot 2024-07-16 232659

Screenshot 2024-07-16 232758

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
723 questions
ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,371 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,608 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Michael Taylor 50,996 Reputation points
    2024-07-16T21:21:14.36+00:00

    Quick action the error in the IDE and it'll give you the option(s) needed to fix this problem.

    Also, I would not recommend doing this. In general connection strings and other "static" configuration should be done as part of app startup in your entry point, not here when configuring the context. This method is designed for making any final configuration changes needed before the context is ready to go. Setting connection strings should be done as part of the app startup because they should be stored outside the code. You should probably move this call into where you're calling AddDbContext which is where it normally occurs.

    0 comments No comments