Asp.net 核心 RC2 未检测到对 nuget 包的引用

Asp.net Core RC2 not detecting Reference to nuget package

我正在为 Web 应用程序使用 Clean RC2 模板。

添加对 System.linq 的引用后,它给了我这个:

我使用 461 作为框架。

您应该已经能够在您的代码中使用 LINQ(使用 System.Linq)而无需添加引用。

由于您的目标是 .NET 461,因此您可以在 project.json 的 frameworkAssemblies 部分添加任何其他 GAC 引用,例如

"frameworks": {
    "net461": {
        "frameworkAssemblies": {
            "System.ServiceProcess": "4.0.0.0",
            "System.Configuration": "4.0.0.0"
        }
    }
},

请参阅此 了解依赖项和框架组件之间的解释。

它会自动恢复包版本以匹配目标框架版本 (net461)。 所以实际上它是 "detecting" nuget 包。 您试图在图像中定位 461,因此包从 .net core preview1 回滚到 .net framework 4.6.1 。 如果你想要目标多个框架(或者我看到你想要 RC2 包,意思是想要 .net 核心),你的 config.json 文件的框架部分应该是这样的,例如:

"frameworks": {
  "net461": { // old .net framework
      "dependencies":{
        "System.LINQ": "4.0.0.0"
      }
   },
   "netstandard1.5":{ // .net core
       "dependencies":{
        "System.LINQ": "4.1.0-RC2-*"
      }
   }
},

Here 是有关定位平台的好信息

如果您只想使用 .net 核心,请删除 net461。

我知道你想要 ASP.net 核心。 Here 是一些 cli ASP MVC 示例。 Here 是一个非常好的 ASP.net 核心示例项目(使用最新的 .net 核心,您必须更新到 RTM/preview2)