Asp.net mvc 5 NuGet无法与Asp5-Mvc6一起正常工作
在新的Asp.net mvc 5 NuGet无法与Asp5-Mvc6一起正常工作,asp.net-mvc-5,nuget,asp.net-core,dnx,Asp.net Mvc 5,Nuget,Asp.net Core,Dnx,在新的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
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可以毫无问题地恢复theese
当.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上的规范,命令行工具应该理解json配置文件:
当使用新的包还原工具dnu时,没有问题-它只获取nuget包并忽略程序集依赖项
一种解决方案是为
project.json
文件调用DNU
,对于旧的packages.config
,您需要使用dnu restore
来还原project.json
项目,对于.csproj
项目,您需要使用dnu restore
来还原
不过,我们正在将所有恢复逻辑移到numget
听起来像是将所有东西都放在一个地方的BEDTT想法:)你知道nuget什么时候能与project.json包完全配合使用吗?我们希望它能在下一个版本中实现