我正尝试在Visual Studio代码中使用EntityFrameworkCore构建DotNetCore WebApi。无法在Visual Studio代码中为EntityFrameworkCore添加迁移
我一直在读了一些教程,我一直在点卡住的地方说:
运行Add-Migration InitialCreate
我得到以下错误:
The term 'add-migration' is not recognized as the name of a cmdlet, function, script file, or operable program
其他教程说我应该运行这个命令 dotnet ef migrations add InitialCreate
这给了我错误: No executable found matching command "dotnet-ef"
这些人是我的csproj的引用:
<PackageReference Include="Microsoft.AspNetCore" Version="1.1.2"/>
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.3"/>
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.2"/>
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="1.1.0"/>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="1.1.2"/>
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="1.1.1"/>
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="1.1.0-preview4-final"/>
我如何添加一个迁移?
你在与proj文件相同的目录中运行该命令? – DavidG
no'dotnet-ef'但是'dotnet ef'另外,确保你正在从包含'project.json'的目录运行'dotnet ef' – tchelidze
@tchelidze'dotnet ef'会调用'dotnet-ef',这是完美的正常。 – DavidG