我对.NET Core相当陌生,我有一个.NET Core WebAPI项目MyWebApp,也有,我有一个使用EntityFrameworkCore的.Net Core类库项目MyLib
I am rather new to the .NET Core, and I got a .NET Core WebAPI project MyWebApp, also, i have .Net Core Class Library project MyLib using EntityFrameworkCore
当我尝试使用Add-Migration时,出现错误 指定的deps.json [... \MyWebApp\bin\Debug\netcoreapp1 .1\MyWebApp.deps.json]不存在
When i try to use Add-Migration, i get the error The specified deps.json [...\MyWebApp\bin\Debug\netcoreapp1.1\MyWebApp.deps.json] does not exist
检查文件夹,我注意到我在[... \MyWebApp\bin中有一个文件\Debug\netcoreapp1.1\win10-x64\MyWebApp.deps.json]
Inspecting the folder, I noticed I have this a file in [...\MyWebApp\bin\Debug\netcoreapp1.1\win10-x64\MyWebApp.deps.json]
但我真的不知道该怎么办解决这个问题。
but i really can't figure what i am supposed to do to resolve this.
myWebApi project.json:
myWebApi project.json:
{ "dependencies": { "ShopManager": "1.0.0-*", "Microsoft.AspNetCore.StaticFiles": "1.1.0", "Microsoft.AspNetCore.Mvc": "1.1.0", "Microsoft.AspNetCore.Server.IISIntegration": "1.1.0", "Microsoft.AspNetCore.Server.Kestrel": "1.1.0", "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.1.0", "Microsoft.Extensions.Configuration.FileExtensions": "1.1.0", "Microsoft.Extensions.Configuration.Json": "1.1.0", "Microsoft.Extensions.Logging": "1.1.0", "Microsoft.Extensions.Logging.Console": "1.1.0", "Microsoft.Extensions.Logging.Debug": "1.1.0", "Microsoft.Extensions.Options.ConfigurationExtensions": "1.1.0", "Microsoft.NETCore.App": "1.1.0" }, "tools": { "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final" }, "runtimes": { "win10-x64": "" }, "frameworks": { "netcoreapp1.1": { "imports": [ "dotnet5.6", "portable-net45+win8" ] } }, "buildOptions": { "emitEntryPoint": true, "preserveCompilationContext": true }, "runtimeOptions": { "configProperties": { "System.GC.Server": true } }, "publishOptions": { "include": [ "wwwroot", "Views", "Areas/**/Views", "appsettings.json", "web.config" ] }, "scripts": { "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ] } }推荐答案
运行时在 project.json 看起来可疑。一旦只为一个运行时生成-无需使用它。
runtimes section in project.json looks suspicious. As soon as you build for one runtime only - there is no need to use it.
删除它并从 Microsoft.NETCore重写依赖关系。 App: 1.1.0 到 Microsoft.NETCore.App:{ type: platform, version: 1.1.0} 。
这会将您的应用程序部署模型从独立(即使没有框架也可以在特定平台上运行)更改为依赖框架 (可以在安装了框架的任何平台上运行)。详细信息在这里。
This will change your app deployment model from "self-contained" (can run on specific platform even without framework) to "framework-dependent" (may run on any platform with framework installed). Details are here.
更多推荐
指定的deps.json'$$$'不存在
发布评论