gpt4 book ai didi

asp.net-core - VS 2015 中的 Asp.net Core EF

转载 作者:行者123 更新时间:2023-12-01 09:48:49 25 4
gpt4 key购买 nike

我关注 ASP.NET Core - New Database在 VS 2015 下的 Asp.net Core 中使用 EF。但安装包后出现以下错误。

Startup project 'src\CoreMVCWebAPI' is an ASP.NET Core or .NET Core project for Visual Studio 2015. This version of the Entity Framework Core Package Manager Console Tools doesn't support these types of projects.

在文档中,它说,它需要 VS 2017 RC,我想知道它是否在 VS 2015 下可用,或者是否有任何解决方法可以在 Asp.net Core 或 Ado.net 中使用 EF 来检索数据来自 SQL 数据库。

PM> Add-Migration MyFirstMigration
Invalid object passed in, ':' or '}' expected. (339): {
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.1",
"type": "platform"
},
"Microsoft.AspNetCore.Diagnostics": "1.0.0",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.1",
"Microsoft.Extensions.Logging.Console": "1.0.0",
//Dependence for MVC
"Microsoft.AspNetCore.Mvc": "1.1.1",
"Microsoft.AspNetCore.StaticFiles": "1.1.0",
"Microsoft.Extensions.Configuration.FileExtensions": "1.1.0",
"Microsoft.Extensions.Configuration.Json": "1.1.0",
//Dependence for EF
"Microsoft.EntityFrameworkCore":"1.1.0",
"Microsoft.EntityFrameworkCore.InMemory": "1.1.0",
"Microsoft.EntityFrameworkCore.SqlServer": "1.1.0",
"Microsoft.EntityFrameworkCore.Tools":"1.1.0-preview4-final"
//Dependence for EF with SQL, this is avalible under VS 2017 RC
//"Microsoft.EntityFrameworkCore.SqlServer": "1.1.0",
//Entity Framework commands to maintain the database
//"Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview4-final"
},

"tools": {
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
},

"frameworks": {
"netcoreapp1.0": {
"imports": [
"dotnet5.6",
"portable-net45+win8"
]
}
},

"buildOptions": {
"emitEntryPoint": true,
//used for Razor pages which are compiled at runtime,and the compiler needs access to reference assemblies,
//to make sure it compiles correctly
"preserveCompilationContext": true
},

"runtimeOptions": {
"configProperties": {
"System.GC.Server": true
}
},

"publishOptions": {
"include": [
"wwwroot",
"web.config"
]
},

"scripts": {
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
}
}

源代码:https://github.com/Edward-Zhou/DotNetCore

最佳答案

您不能在 CSproj (Visual Studio 2015) 项目中使用 MSBuild (Visual Studio 2017) 包。例如,如果您将 Microsoft.EntityFrameworkCore.Tools 版本从 1.1.0-msbuild3-final 更改为 1.1.0-preview4-final应该工作

为了严格遵守 JSON 格式,project.json 中也不允许注释。有关更多信息/讨论,请参阅此公告 github.com/aspnet/Announcements/issues/24 和链接问题。

关于asp.net-core - VS 2015 中的 Asp.net Core EF,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42530936/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com