NuGet无法与Asp5-Mvc6一起正常工作 [英] NuGet not working properly with Asp5-Mvc6
问题描述
在以新的 xproj
项目类型还原软件包时,在 project.json
中有新的软件包配置:
When restoring packages in the new xproj
project types, there are the new package config in the 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可以毫无问题地恢复泰斯语.
Nuget restores theese with no problem.
当 .xproj
依赖于普通的 .proj
文件时,有时您需要创建包装器,并编写如下所示的依赖项:
When the .xproj
depends on normal .proj
files, you sometimes needs to create wrappers, and write the dependency like this:
"frameworks": {
"dnx46": {
"dependencies": {
"SomeOldProjectAssembly": "1.0.0-*"
}
}
}
包装器在这里并不重要.
The wrapper is not important here.
使用nuget还原软件包时,请在以下 project.json
文件中: nuget restore.\ project.json
还原nuget软件包,但Nuget.exe也会尝试恢复逐步依赖.
When using nuget to restore packages, in this project.json
file: nuget restore .\project.json
the nuget packages is restored, but Nuget.exe also tries to restore the assemply dependencies.
我从Nuget.exe收到此错误:
I get this error from 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上的规格,命令行工具应了解json配置文件: https://docs.nuget.org/Consume/ProjectJson-Intro
From the specs found on nuget, the command line tool should understand the json config file: https://docs.nuget.org/Consume/ProjectJson-Intro
使用新的软件包还原工具 dnu
时,没有问题-它仅获取nuget软件包,而忽略程序集依赖项.
When using the new package restore tool dnu
, there is no problems - it only fetches the nuget packeges and ignores the assembly dependencies.
一种解决方案是为 project.json
文件调用 DNU
,为旧的 packages.config
调用nuget-但这不是方便.
One solution is to call DNU
for the project.json
files, and nuget for the old packages.config
- but thats just not convenient.
推荐答案
当前情况是,您需要使用 dnu restore
来还原 project.json
项目和< .csproj
项目的code> nuget restore .
The current situation is that you need to use dnu restore
to restore project.json
projects and nuget restore
for .csproj
projects.
我们正在努力将所有还原逻辑移至 nuget
.
We are working on moving all restore logic to nuget
though.
这篇关于NuGet无法与Asp5-Mvc6一起正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!