ASP.NET 5:错误的NuGet包类库包

问题描述:

我开始用VS2015社区版和ASP.NET 5.ASP.NET 5:错误的NuGet包类库包

我添加了一个新的类库(包)作为一个新的项目到我的解决办法玩但我无法在其中安装NuGet软件包。恢复后,我有一个“参考(错误 - 请参阅错误列表)”。

如果我将一个基本的Library Class(.dll)作为新项目添加到我的解决方案中,并尝试安装相同的NuGet软件包,它可以像以前一样精美地运行。

也许,我误解这个新的类库包是如何工作的,我试图滥用它......

感谢您的帮助。

---------------------------------------------- ----------------编辑1 -------------------------------- --------------------------- Project.json:该情况下的警告标志位于EF包装上: Class Libary package with error on 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": { } 
    } 
} 

----------------------------------------------- -----编辑1之二后更新至beta8 --------------------------

{ 
    "version": "1.0.0-*", 
    "description": "ClassLibrary5 Class Library", 
    "authors": [ "SylvainC" ], 
    "tags": [ "" ], 
    "projectUrl": "", 
    "licenseUrl": "", 
    "frameworks": { 
    "dnx451": { } 
    }, 
    "dependencies": { 
    "EntityFramework": "6.1.3" 
    } 
} 

----- -------------------------------------------------- -------编辑2 ----------------------------------------- ------------------

升级dnvm(dvnm升级)后,我能够运行“dnu restore”命令但出现以下错误:

>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 --- 

---------------------------------------------编辑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

请问您可以分享一下project.json文件吗? –

+0

右键点击引用并选择恢复包。输出窗口中显示了什么? – firste

+0

我有同样的问题,并通过从命令行运行''''dnu restore'''来解决它。 – ahz

要确定你安装了t他为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

尝试包。json like this

{ 
    "version": "1.0.0-*", 
    "description": "ClassLibrary3 Class Library", 
    "authors": [ "Thom" ], 
    "tags": [ "" ], 
    "projectUrl": "", 
    "licenseUrl": "", 
    "dependencies": { 

    "EntityFramework": "6.1.3" 
    }, 
    "frameworks": { 
     "dnx451": { }, 
    } 
} 
+0

谢谢@ thom-kiesewetter指向我的工具页面。我按照你的指示,我有beta8 x86默认情况下,尝试了dnu恢复(dnu恢复 - 无缓存 - 包装。\ EntityFramework),但仍然得到这个错误: GET https://www.nuget.org/api/v2/FindPackagesById()?id ='EntityFramework' 错误:FindPackagesById:EntityFramework 发送请求时发生错误。 我也用我的新beta8 project.json和提要编辑了我的帖子。 它可能是这些讨论中定义的代理问题:https://github.com/aspnet/dnx/issues/451 – sylvain77

这似乎是一个代理问题,给我这个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-

我也尝试创建一个dnx.exe.config到C:\Users\sylvainc\.dnx\runtimes\dnx-clr-win-x86.1.0.0-beta8\bin,http://github.com/aspnet/dnx/issues/451建议。 不幸的是,它似乎不适用于beta8版本。

我的第一个解决方法是使用HTTP协议访问我的NuGet包,如下所示:​​。

我最终的解决办法是编辑machine.config文件以管理员身份用记事本+在C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config得到提琴手默认的代理定义的平顺性和使用该系统的:

<!--<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部作品很好,我甚至有我现在的智能感知正常工作,这是不是这种情况之前与其他代理定义...

感谢

西尔

+0

提琴手也是我的原因。 – theguy

就我而言,包源代码指向http://packagesource。修改为https://www.nuget.org/api/v2/修复了probmel