我刚刚更新到Visual Studio 2015 Update 3并安装了DotNetCore.1.0.0-VS2015Tools.Preview2 https://www.microsoft.com/net/core#windows。
然后我创建了一个包含web.api的asp.net核心的新项目,在Visual Studio开始恢复nuget之后我收到了以下错误:
C:\ Private \ Commercify \ Dev \ WebApis \ Commercify.Catalog.WebApi \ project.json中的错误
软件包Microsoft.AspNetCore.Mvc 1.0.0与netcoreapp1.0(.NETCoreApp,Version = v1.0)不兼容。软件包Microsoft.AspNetCore.Mvc 1.0.0支持:
- net451(.NETFramework,Version = v4.5.1)
- netstandard1.6(.NETStandard,Version = v1.6)
一个或多个软件包与.NETCoreApp,Version = v1.0不兼容。
这是我的整个project.json
我没有更改任何内容但它包含Visual Studio为新的ASP.NET Core Web API项目生成的内容:
{
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.0",
"type": "platform"
},
"Microsoft.AspNetCore.Mvc": "1.0.0",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
"Microsoft.Extensions.Configuration.FileExtensions": "1.0.0",
"Microsoft.Extensions.Configuration.Json": "1.0.0",
"Microsoft.Extensions.Logging": "1.0.0",
"Microsoft.Extensions.Logging.Console": "1.0.0",
"Microsoft.Extensions.Logging.Debug": "1.0.0",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0"
},
"tools": {
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
},
"frameworks": {
"netcoreapp1.0": {
"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文件,在“Microsoft.AspNetCore.Mvc”:“1.0.0”上显示红色波浪形,表示:
依赖项Microsoft.AspNetCore.Mvc 1.0.0不支持框架.NETCoreApp,Version = v1.0
我该如何解决这个问题?