[英]Package Manager in VS2015 RC fails on installing/restoring some packages
我正在嘗試從nuget.org( https://www.nuget.org/packages/NGenerics/ )安裝nuget包-NGenerics.1.4.1到ASP.NET 5項目(網站)中。 程序包管理器失敗,出現UriFormatException。 之后,將引用添加到解決方案資源管理器的“引用”文件夾中,但帶有黃色三角形(“警告”)。
添加到錯誤列表中的錯誤:“無法解決Dependency NGenerics> = 1.4.1.0”。
我也嘗試從本地文件夾注冊表進行安裝。
這是msconnect上的錯誤。
我想知道是否有人遇到同樣的問題,因為我在google中找不到任何東西。 也歡迎任何解決方法。
包管理器的輸出:
Installing NuGet package NGenerics.1.4.1.
Successfully installed 'NGenerics.1.4.1' to Samples.AjaxDemo2.
========== Finished ==========
Restoring packages for D:\Work\Apps\Samples.AjaxDemo2\project.json
----------
System.UriFormatException: Invalid URI: The format of the URI could not be determined.
at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind)
at System.Uri..ctor(String uriString)
at Microsoft.Framework.PackageManager.PackageSourceUtils.CreatePackageFeed(PackageSource source, Boolean noCache, Boolean ignoreFailedSources, Reports reports)
at Microsoft.Framework.PackageManager.RestoreCommand.AddRemoteProvidersFromSources(List`1 remoteProviders, List`1 effectiveSources)
at Microsoft.Framework.PackageManager.RestoreCommand.<RestoreForProject>d__74.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Framework.PackageManager.RestoreCommand.<>c__DisplayClass73_0.<<ExecuteCommand>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Framework.PackageManager.RestoreCommand.<ExecuteCommand>d__73.MoveNext()
----------
Restore failed
Invalid URI: The format of the URI could not be determined.
我今天在Visual Studio 2013上偶然發現了同一問題,使用的是NuGet 2.8.5。@ Shrike的答案幫助我發現這是自定義NuGet.config中相對路徑的規范。 由於出現System.Uri
它必須能夠解析它,因此您要做的就是確保相對路徑是正確的合法URI。 相對文件URI必須以'./'開頭(obv也不要使用反斜杠,它們是Windows Thing!)。 請參閱c#類型以處理相對和絕對URI以及本地文件路徑
例如使用:
<add key="local-feed" value="./lib/nuget-feed" />
代替:
<add key="local-feed" value="lib/nuget-feed" />
刪除本地提要不是一個好主意,因為您現在必須從其他提要中恢復,這可能不是您想要的(就個人而言,鑒於它具有停機時間的記錄,我不會將自己的構建押在nuget畫廊上。 。)
最終我發現了問題所在。 在文件夾結構中,我的解決方案上方的某個地方有“ .nuget \\ NuGet.config”文件。
NuGet.config包含具有相對文件路徑的軟件包源:
<configuration>
<packageSources>
<add key="local" value="..\..\..\Release"/>
</packageSources>
</configuration>
當我刪除VS中的packageSource軟件包管理器后,它開始工作。
這有點荒謬。
希望它可以幫助某人不要像我那么長時間。
在浪費了大約兩個小時之后,我發現我的包源已添加到.nuget \\ NuGet.config中的disabledPackageSources部分中。 我只需要從禁用列表中將其刪除。
<disabledPackageSources>
<add key="RaNuget" value="true" />
</disabledPackageSources>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.