我无法让实体框架与我的ASP.NET核心项目一起工作,因此我决定尝试通过此github链接使用示例音乐商店项目来实现它。
我已确保目录包管理器控制台是项目的根目录,其中project.json文件位于“\ samples \ MusicStore”。 我还将config.json文件中的连接字符串更新为本地数据库。
当我尝试运行任何dotnet ef命令时,我收到以下错误
No executable found matching command "dotnet-ef"
然后我尝试安装Microsoft.EntityFrameworkCore.Tools包,因为我注意到它在项目中不存在。我再次尝试,得到同样的错误。
我没有对该项目进行任何其他更改。
中拍摄的图像project.json文件:
{
"authors": [
"Microsoft"
],
"description": "Music store application on ASP.NET 5",
"version": "1.1.0-*",
"buildOptions": {
"copyToOutput": {
"include": [
"Areas",
"Views",
"wwwroot",
"config.json",
"web.config",
"ForTesting/**/*.json"
]
},
"define": [
"DEMO"
],
"emitEntryPoint": true,
"preserveCompilationContext": true,
"warningsAsErrors": true
},
"publishOptions": {
"include": [
"Areas",
"Views",
"wwwroot",
"config.json",
"web.config",
"ForTesting/**/*.json"
]
},
"dependencies": {
"Microsoft.AspNetCore.Authentication.Cookies": "1.1.0-*",
"Microsoft.AspNetCore.Authentication.Facebook": "1.1.0-*",
"Microsoft.AspNetCore.Authentication.Google": "1.1.0-*",
"Microsoft.AspNetCore.Authentication.MicrosoftAccount": "1.1.0-*",
"Microsoft.AspNetCore.Authentication.OpenIdConnect": "1.1.0-*",
"Microsoft.AspNetCore.Authentication.Twitter": "1.1.0-*",
"Microsoft.AspNetCore.Diagnostics": "1.1.0-*",
"Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore": "1.1.0-*",
"Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.1.0-*",
"Microsoft.AspNetCore.Mvc": "1.1.0-*",
"Microsoft.AspNetCore.Mvc.TagHelpers": "1.1.0-*",
"Microsoft.AspNetCore.Server.IISIntegration": "1.1.0-*",
"Microsoft.AspNetCore.Server.Kestrel": "1.1.0-*",
"Microsoft.AspNetCore.Server.WebListener": "1.1.0-*",
"Microsoft.AspNetCore.Session": "1.1.0-*",
"Microsoft.AspNetCore.StaticFiles": "1.1.0-*",
"Microsoft.EntityFrameworkCore": "1.1.0-preview2-22516",
"Microsoft.EntityFrameworkCore.InMemory": "1.1.0-*",
"Microsoft.EntityFrameworkCore.SqlServer": "1.1.0-*",
"Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview4-22487",
"Microsoft.Extensions.Configuration.CommandLine": "1.1.0-*",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.1.0-*",
"Microsoft.Extensions.Configuration.Json": "1.1.0-*",
"Microsoft.Extensions.Logging.Console": "1.1.0-*",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.1.0-*"
},
"tools": {
"Microsoft.EntityFrameworkCore.Tools": {
"version": "1.0.0-*",
"imports": "portable-net452+win81"
}
},
"frameworks": {
"net451": {},
"netcoreapp1.1": {
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.1.0-*",
"type": "platform"
}
}
}
},
"scripts": {
"postpublish": "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%"
}
}