10

我在恢复 ASP.NET 5/ASP.NET Core 1.0 的依赖项时出错。

似乎有几个依赖项(即Microsoft.CodeAnalysis.CSharp/ .CommonMicrosoft.AspNet.Mvc被固定为看似过时的包。

对此的要求是使用dotnetcli 工具并同时针对 .NET Vanilla 和 .NET Core。

有什么方法可以让 Mvc 引用与 Core 兼容的 CodeAnalysis 版本?


在 Visual Studio 2015 (v14.0.24729.00 Update 1) 中重现的步骤:

  1. 文件 > 新建 > 项目 > Web > ASP.NET Web 应用程序
  2. API.NET 5 模板 > Web API
  3. 打开PM,运行命令dotnet restore

输出:

info : Restoring packages for C:\PATH_TO_SOLUTION\WebApplication2\src\WebApplication2\project.json...
error: Microsoft.CodeAnalysis.CSharp 1.1.0-rc1-20151109-01 is not compatible with DNXCore,Version=v5.0.
error: Microsoft.CodeAnalysis.Common 1.1.0-rc1-20151109-01 is not compatible with DNXCore,Version=v5.0.
error: Some packages are not compatible with DNXCore,Version=v5.0.
error: Microsoft.CodeAnalysis.CSharp 1.1.0-rc1-20151109-01 is not compatible with DNXCore,Version=v5.0 (win7-x64).
error: Microsoft.CodeAnalysis.Common 1.1.0-rc1-20151109-01 is not compatible with DNXCore,Version=v5.0 (win7-x64).
... (loads more errors) ...

project.json文件包含:

{
  ...
  "dependencies": {
    ...
    "Microsoft.AspNet.Mvc": "6.0.0-rc1-final",
    ...
  }
  ...
  "frameworks": {
    "dnx451": { },
    "dnxcore50": { }
  },
  ...
}
4

2 回答 2

3

使用(当前)最新的稳定版本仅适用于目标框架 dnxcore50。在我的 project.json 中:

"Microsoft.CodeAnalysis.Common": "1.1.1",
"Microsoft.CodeAnalysis.CSharp": "1.1.1"
于 2016-02-15T12:18:57.070 回答
2

只需Microsoft.CodeAnalysis.CommonNuGet 包管理器安装最新版本对我来说效果很好。

于 2017-12-05T16:36:55.563 回答