2015-10-26 90 views
2

我開始用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

回答

0

要確定你安裝了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

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-

我也嘗試創建一個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