【问题标题】:NuGet not working properly with Asp5-Mvc6NuGet 无法与 Asp5-Mvc6 一起正常工作
【发布时间】:2015-11-26 01:10:09
【问题描述】:

在新的xproj项目类型中恢复包时,project.json中有新的包配置:

"dependencies": {
        "Microsoft.AspNet.Authentication.Cookies": "1.0.0-rc1-final",
        "Microsoft.AspNet.Authentication.Facebook": "1.0.0-rc1-final",
        "Microsoft.AspNet.Authentication.Google": "1.0.0-rc1-final",
        ....
}

Nuget 可以毫无问题地恢复这些。

当.xproj依赖于普通的.proj文件时,有时需要创建包装器,并像这样编写依赖:

"frameworks": {
        "dnx46": {
            "dependencies": {
                "SomeOldProjectAssembly": "1.0.0-*"
            }
        }
    }

包装在这里并不重要。

当使用 nuget 还原包时,在此 project.json 文件中:nuget restore .\project.json nuget 包已还原,但 Nuget.exe 也会尝试还原组件依赖项。

我从 Nuget.exe 收到此错误:

C:\SomePlace> nuget.exe restore .\project.json
MSBuild auto-detection: using msbuild version '14.0' from 'C:\Program Files (x86)\MSBuild\14.0\bin'.
Restoring packages for C:\SomePlace\project.json...
  NotFound https://api.nuget.org/v3-flatcontainer/escenic.net/index.json 639ms
  NotFound https://api.nuget.org/v3-flatcontainer/escenic.net.configgenerator/index.json 713ms
  NotFound https://api.nuget.org/v3-flatcontainer/escenic.net.base/index.json 720ms
Unable to resolve SomeOldProjectAssembly (≥ 1.0.0--) for DNX,Version=v4.6.
Exception of type 'NuGet.CommandLineException' was thrown.

从nuget上的specs来看,命令行工具应该理解json配置文件:https://docs.nuget.org/Consume/ProjectJson-Intro

当使用新的包恢复工具dnu时,没有问题——它只获取nuget包并忽略程序集依赖。

一种解决方案是为project.json 文件调用DNU,为旧的packages.config 调用nuget - 但这并不方便。

【问题讨论】:

标签: asp.net-mvc-5 nuget asp.net-core dnx


【解决方案1】:

目前的情况是需要使用dnu restore恢复project.json项目,nuget restore恢复.csproj项目。

不过,我们正在努力将所有恢复逻辑移至 nuget。

【讨论】:

  • 听起来像是把它全部放在一个地方的最糟糕的主意:) 知道什么时候 nuget 可以完全与 project.json 包一起工作吗?
  • 我们希望它会在下一个版本中发生
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2017-12-14
  • 2020-08-19
  • 2013-02-06
  • 2019-02-02
  • 2021-10-15
  • 2016-07-05
  • 2016-09-13
相关资源
最近更新 更多