当前位置 : 主页 > 网络编程 > ASP >

asp.net-core – VS 2015中的Asp.net核心EF

来源:互联网 收集:自由互联 发布时间:2021-06-24
我遵循 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 versi
我遵循 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 DataBase中检索数据.

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它应该工作

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

网友评论