项目中的依赖项Microsoft.AspNet.Cors 5.0.0-beta1不支持框架DNXCore,Version = v5.0

时间:2018-04-10 17:34:32

标签: asp.net asp.net-mvc asp.net-web-api asp.net-core

我最近开始学习ASP.Net Core 2.0。我创建了项目但是当我运行Startup.cs时出现以下错误。

  

项目中的依赖项Microsoft.AspNet.Cors 5.0.0-beta1    projectName 不支持框架DNXCore,Version = v5.0。

这是project.json文件

{
    "webroot": "wwwroot",
    "userSecretsId": "aspnet5-WebApplication2-2cf34be9-ba73-4035-85b3-2a2e109c4fea",
    "version": "1.0.0-*",

    "dependencies": {
        "EntityFramework.SqlServer": "7.0.0-beta5",
        "EntityFramework.Commands": "7.0.0-beta5",
        "Microsoft.AspNet.Mvc": "6.0.0-beta5",
        "Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-beta5",
        "Microsoft.AspNet.Authentication.Cookies": "1.0.0-beta5",
        "Microsoft.AspNet.Authentication.Facebook": "1.0.0-beta5",
        "Microsoft.AspNet.Authentication.Google": "1.0.0-beta5",
        "Microsoft.AspNet.Authentication.MicrosoftAccount": "1.0.0-beta5",
        "Microsoft.AspNet.Authentication.Twitter": "1.0.0-beta5",
        "Microsoft.AspNet.Diagnostics": "1.0.0-beta5",
        "Microsoft.AspNet.Diagnostics.Entity": "7.0.0-beta5",
        "Microsoft.AspNet.Identity.EntityFramework": "3.0.0-beta5",
        "Microsoft.AspNet.Server.IIS": "1.0.0-beta5",
        "Microsoft.AspNet.Server.WebListener": "1.0.0-beta5",
        "Microsoft.AspNet.StaticFiles": "1.0.0-beta5",
        "Microsoft.AspNet.Tooling.Razor": "1.0.0-beta5",
        "Microsoft.Framework.Configuration.Abstractions": "1.0.0-beta5",
        "Microsoft.Framework.Configuration.Json": "1.0.0-beta5",
        "Microsoft.Framework.Configuration.UserSecrets": "1.0.0-beta5",
        "Microsoft.Framework.Logging": "1.0.0-beta5",
        "Microsoft.Framework.Logging.Console": "1.0.0-beta5",
        "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-beta5",
        "Microsoft.AspNet.Hosting.Abstractions": "1.0.0-beta5"
    },

    "commands": {
        "web": "Microsoft.AspNet.Hosting --config hosting.ini",
        "ef": "EntityFramework.Commands"
    },

    "frameworks": {
        "dnx451": {
            "dependencies": {
                "Microsoft.AspNet.Hosting": "1.0.0-beta5"
            }
        },
        "dnxcore50": { }
    },

    "exclude": [
        "wwwroot",
        "node_modules",
        "bower_components"
    ],
    "publishExclude": [
        "node_modules",
        "bower_components",
        "**.xproj",
        "**.user",
        "**.vspscc"
    ],
    "scripts": {
        "prepublish": [ "npm install", "bower install", "gulp clean", "gulp min" ]
    }
}

1 个答案:

答案 0 :(得分:1)

ASP.Net Core 2.0不再有project.json了。我猜你正在使用旧版本的visual studio,或者你的系统上没有安装最新的dotnet核心。

您必须拥有Visual Studio 2017 15.5

此外,您必须从https://www.microsoft.com/net/learn/get-started/windows

获取最新的dotnet核心