我跟着ASP.NET Core - New Database使用EF在Asp.net核心VS 2015下,但在安裝包後得到了下面的錯誤。Asp.net核心EF在2015年VS
啓動項目「的src \ CoreMVCWebAPI」是一個ASP.NET核心或.NET核心 項目爲Visual Studio 2015這個版本的實體框架 Core軟件包管理器控制檯工具不支持這些類型的 項目。
在該文件中,它說,它需要VS 2017年RC,我想知道它是否是2015年VS下提供,或者是有,我可以在Asp.net核心,或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
你使用哪個工具版本?目前的變化與2017年VS改變項目格式發生,所以最新的工具版本(版本高於preview2)不會VS 2015 – poke
使用此[鏈接](https://docs.microsoft.com/en工作-us/ASPNET /核心/數據/ EF-MVC /介紹)。這說明了如何使用實體框架的核心1.0和Visual Studio 2015年 – Sanket