我开始玩VS2015社区版和ASP.NET 5。
我已将新的类库(Package)添加为我的解决方案中的新项目,但无法在其中安装NuGet包。恢复后,我有一个"参考(错误 - 参见错误列表)"。
如果我将一个基本的库类(.dll)作为一个新项目添加到我的解决方案中并尝试安装相同的NuGet包,它会像过去一样漂亮地工作。
也许,我误解了这个新的类库包的工作方式,我试图误用它...
感谢您的帮助。
----------------------------------------------- ---------------编辑1 --------------------------------- -------------------------- Project.json:那种情况下的警告标志位于EF包中:
{
"version": "1.0.0-*",
"description": "testFinal Class Library",
"authors": [ "SylvainC" ],
"tags": [ "" ],
"projectUrl": "",
"licenseUrl": "",
"dependencies": {
"System.Collections": "4.0.10-beta-23019",
"System.Linq": "4.0.0-beta-23019",
"System.Threading": "4.0.10-beta-23019",
"System.Runtime": "4.0.10-beta-23019",
"Microsoft.CSharp": "4.0.0-beta-23019",
"EntityFramework": "6.1.3"
},
"frameworks": {
"dotnet": { }
}
}
----------------------------------------------- -----更新到beta8后编辑1 bis --------------------------
{
"version": "1.0.0-*",
"description": "ClassLibrary5 Class Library",
"authors": [ "SylvainC" ],
"tags": [ "" ],
"projectUrl": "",
"licenseUrl": "",
"frameworks": {
"dnx451": { }
},
"dependencies": {
"EntityFramework": "6.1.3"
}
}
----------------------------------------------- ---------------编辑2 --------------------------------- --------------------------
升级dnvm(dvnm升级版)后,我能够运行" dnu恢复"命令但得到以下错误:
>dnu restore
Microsoft .NET Development Utility Clr-x86-1.0.0-beta8-15858
GET https://www.nuget.org/api/v2/
GET https://www.myget.org/F/aspnetmaster/api/v2/
Restoring packages for D:\testFinal\project.json
GET https://www.nuget.org/api/v2/FindPackagesById()?id='System.Reflection'
GET https://www.myget.org/F/aspnetmaster/api/v2/FindPackagesById()?id='System.Reflection'
GET https://www.nuget.org/api/v2/FindPackagesById()?id='System.Globalization'
GET https://www.myget.org/F/aspnetmaster/api/v2/FindPackagesById()?id='System.Globalization'
GET https://www.nuget.org/api/v2/FindPackagesById()?id='EntityFramework'
GET https://www.myget.org/F/aspnetmaster/api/v2/FindPackagesById()?id='EntityFramework'
Warning: FindPackagesById: System.Globalization
An error occurred while sending the request.
Warning: FindPackagesById: System.Globalization
An error occurred while sending the request.
Warning: FindPackagesById: System.Reflection
An error occurred while sending the request.
GET https://www.myget.org/F/aspnetmaster/api/v2/FindPackagesById()?id='System.Globalization'
GET https://www.myget.org/F/aspnetmaster/api/v2/FindPackagesById()?id='System.Reflection'
GET https://www.nuget.org/api/v2/FindPackagesById()?id='System.Globalization'
Warning: FindPackagesById: System.Reflection
An error occurred while sending the request.
GET https://www.nuget.org/api/v2/FindPackagesById()?id='System.Reflection'
Warning: FindPackagesById: EntityFramework
An error occurred while sending the request.
Warning: FindPackagesById: EntityFramework
An error occurred while sending the request.
GET https://www.nuget.org/api/v2/FindPackagesById()?id='EntityFramework'
GET https://www.myget.org/F/aspnetmaster/api/v2/FindPackagesById()?id='EntityFramework'
Warning: FindPackagesById: System.Reflection
An error occurred while sending the request.
GET https://www.myget.org/F/aspnetmaster/api/v2/FindPackagesById()?id='System.Reflection'
Warning: FindPackagesById: System.Globalization
An error occurred while sending the request.
Warning: FindPackagesById: System.Globalization
An error occurred while sending the request.
GET https://www.nuget.org/api/v2/FindPackagesById()?id='System.Globalization'
GET https://www.myget.org/F/aspnetmaster/api/v2/FindPackagesById()?id='System.Globalization'
Warning: FindPackagesById: System.Reflection
An error occurred while sending the request.
GET https://www.nuget.org/api/v2/FindPackagesById()?id='System.Reflection'
Warning: FindPackagesById: EntityFramework
An error occurred while sending the request.
GET https://www.nuget.org/api/v2/FindPackagesById()?id='EntityFramework'
Warning: FindPackagesById: EntityFramework
An error occurred while sending the request.
GET https://www.myget.org/F/aspnetmaster/api/v2/FindPackagesById()?id='EntityFramework'
Error: FindPackagesById: System.Reflection
An error occurred while sending the request.
----------
Error: FindPackagesById: System.Globalization
An error occurred while sending the request.
Error: FindPackagesById: System.Globalization
An error occurred while sending the request.
System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:8888
at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)
--- End of inner exception stack trace ---
--------------------------------------------- EDIT 3最后的错误和提要------------------------------
Restore failed
An error occurred while sending the request.
NuGet Config files used:
C:\Users\sylvainc\AppData\Roaming\NuGet\nuget.config
Feeds used:
https://www.nuget.org/api/v2/
https://www.myget.org/F/aspnetmaster/api/v2/
西尔
答案 0 :(得分:4)
这似乎是一个代理问题,给我No connection could be made because the target machine actively refused it 127.0.0.1:8888
错误。
使用Fiddler跟踪它,我发现在打开Fiddler后,恢复过程和添加新的Nuget包工作正常。与此帖子Why calling API in ASP.NET works only if I have Fiddler open?或此处非常类似的情况:http://www.telerik.com/blogs/help!-running-fiddler-fixes-my-app-。
我还尝试按照http://github.com/aspnet/dnx/issues/451中的建议在C:\Users\sylvainc\.dnx\runtimes\dnx-clr-win-x86.1.0.0-beta8\bin
中创建一个dnx.exe.config。
不幸的是,它似乎不适用于beta8版本。
我的第一个解决方案是使用HTTP协议访问我的NuGet包,如下所示:Visual Studio 2015 - Can't sign in, Use NuGet, etc. behind corporate proxy。
我的最终解决方案是使用C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config
中的Notepad +以管理员身份编辑machine.config文件,以获取fiddler默认代理定义并使用系统版本:
<!--<system.net>
<defaultProxy enabled="true" useDefaultCredentials="true">
<proxy autoDetect="false" bypassonlocal="false" proxyaddress="http://127.0.0.1:8888" usesystemdefault="false"/>
</defaultProxy>
</system.net>-->
<system.net>
<defaultProxy useDefaultCredentials="true" enabled="true">
<proxy usesystemdefault="True"/>
</defaultProxy>
</system.net>
现在ASP.Net 5工作正常,我现在智能感知工作正常,而其他代理定义并非如此......
由于
西尔
答案 1 :(得分:0)
确保为Visual studio安装了最新工具。你的project.json似乎错了。
在visual studio中检查您的nuget Feed是否有无效的Feed并删除这些来源。
检查您的有效dnx(*)
dnvm list
Active Version Runtime Architecture OperatingSystem Alias
1.0.0-beta4 clr x86 win
1.0.0-beta7 clr x64 win
1.0.0-beta7 clr x86 win b7
1.0.0-beta7 coreclr x64 win
1.0.0-beta7 coreclr x86 win
1.0.0-beta8 clr x64 win
* 1.0.0-beta8 clr x86 win aa, b8
1.0.0-beta8 coreclr x64 win
1.0.0-beta8 coreclr x86 win
1.0.0-rc1-15838 clr x86 win rc1a
1.0.0-rc1-16031 clr x86 win default
1.0.0-rc1-16031 coreclr x86 win
使用tools->nuget package manager-package manager for solution
*选择包源并测试包源是否有任何错误
*找出你的包裹可用的nuget饲料
在dnu输出结束时,有一个列表,其中使用了配置和提要
NuGet Config files used:
C:\Users\Thom\AppData\Roaming\NuGet\nuget.config
Feeds used:
https://api.nuget.org/v3-flatcontainer/
https://www.myget.org/F/aspnetrelease/api/v3/flatcontainer/
使用dnu restore -?
查找问题的根源。
试试这个
dnu restore --no-cache --packages .\packages1
尝试像这样的package.json
{
"version": "1.0.0-*",
"description": "ClassLibrary3 Class Library",
"authors": [ "Thom" ],
"tags": [ "" ],
"projectUrl": "",
"licenseUrl": "",
"dependencies": {
"EntityFramework": "6.1.3"
},
"frameworks": {
"dnx451": { },
}
}
答案 2 :(得分:0)
就我而言,包源指向http://packagesource。将其更改为https://www.nuget.org/api/v2/修复了问题