I have a solution with two projects inside Visual Studio Code:
webapiproject called Sample.API
classlibproject called Sample.Data
In Sample.Data, I have these packages installed:
Microsoft.EntityFrameworkCore.Design Microsoft.EntityFrameworkCore.SqlServer Microsoft.EntityFrameworkCore.Tools
After creating a DbContext for a simple model and specifying the connection string, I run into the following error when executing this command (Inside the Sample.Data folder):
dotnet ef migrations add InitialMigration
Startup project 'Sample.Data.csproj' targets framework '.NETStandard'. There is no runtime associated with this framework, and projects targeting it can't be executed directly. To use the Entity Framework Core .NET Command-line Tools with this project, add an executable project targeting .NET Core or .NET Framework that references this project, and set it as the startup project using --startup-project; or, update this project to cross-target .NET Core or .NET Framework...
If this was Visual Studio, I would set the WebAPI project as the startup project. But I'm using VS Code.
What am I missing?
Thank you @sea_ocean ... You have to specify the startup project:
dotnet ef migrations add MigrationOne --startup-project ../Sample.API/Sample.API.csproj
dotnet ef database update --startup-project ../Sample.API/Sample.API.csproj
You also need to install Microsoft.EntityFrameworkCore.Design to the startup project