[英]Package Manager in VS2015 RC fails on installing/restoring some packages
I'm trying to install a nuget package - NGenerics.1.4.1 from nuget.org ( https://www.nuget.org/packages/NGenerics/ ) into a ASP.NET 5 project (website). 我正在尝试从nuget.org( https://www.nuget.org/packages/NGenerics/ )安装nuget包-NGenerics.1.4.1到ASP.NET 5项目(网站)中。 Package Manager fails with UriFormatException.
程序包管理器失败,出现UriFormatException。 After that a reference is added into Reference folder in the Solution Explorer but with yellow triangle ('warning').
之后,将引用添加到解决方案资源管理器的“引用”文件夹中,但带有黄色三角形(“警告”)。
The error added into the Error List: "Dependency NGenerics >= 1.4.1.0 could not be resolved". 添加到错误列表中的错误:“无法解决Dependency NGenerics> = 1.4.1.0”。
I also tried to install from a local folder registry. 我也尝试从本地文件夹注册表进行安装。
Here's the bug on msconnect . 这是msconnect上的错误。
I wonder whether somebody experienced the same issue as I couldn't find anything in google. 我想知道是否有人遇到同样的问题,因为我在google中找不到任何东西。 Also any workarounds are welcome.
也欢迎任何解决方法。
Package Manager's Output: 包管理器的输出:
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.
I stumbled across the same issue today with NuGet 2.8.5 on Visual Studio 2013. @Shrike's answer helped me find out it's the specification of my relative path in a custom NuGet.config. 我今天在Visual Studio 2013上偶然发现了同一问题,使用的是NuGet 2.8.5。@ Shrike的答案帮助我发现这是自定义NuGet.config中相对路径的规范。 Since it appears
System.Uri
must be able to parse it, all you have to do is ensure the relative path is a proper, legal URI. 由于出现
System.Uri
它必须能够解析它,因此您要做的就是确保相对路径是正确的合法URI。 Relative file URIs must start with './' (obv don't use backslashes either, they're a Windows Thing!). 相对文件URI必须以'./'开头(obv也不要使用反斜杠,它们是Windows Thing!)。 See c# type to handle relative and absolute URI's and local file paths
请参阅c#类型以处理相对和绝对URI以及本地文件路径
Eg Use: 例如使用:
<add key="local-feed" value="./lib/nuget-feed" />
instead of: 代替:
<add key="local-feed" value="lib/nuget-feed" />
Removing the local feed is not a good idea, as you now have to restore from a different feed, which may not be what you want (personally, I wouldn't bet my builds on the nuget gallery given it's track record of downtime...) 删除本地提要不是一个好主意,因为您现在必须从其他提要中恢复,这可能不是您想要的(就个人而言,鉴于它具有停机时间的记录,我不会将自己的构建押在nuget画廊上。 。)
Finally I found out what was wrong. 最终我发现了问题所在。 I had ".nuget\\NuGet.config" file somewhere above of my solution in folder structure.
在文件夹结构中,我的解决方案上方的某个地方有“ .nuget \\ NuGet.config”文件。
That NuGet.config contained a package source with relative file path: NuGet.config包含具有相对文件路径的软件包源:
<configuration>
<packageSources>
<add key="local" value="..\..\..\Release"/>
</packageSources>
</configuration>
As I removed that packageSource Package Manager in VS started working. 当我删除VS中的packageSource软件包管理器后,它开始工作。
It's kinda ridiculous. 这有点荒谬。
Hope it helps somebody not to loose so many hours as me. 希望它可以帮助某人不要像我那么长时间。
After wasting about two hours on the exception I found that my package source is added to the disabledPackageSources section in .nuget\\NuGet.config. 在浪费了大约两个小时之后,我发现我的包源已添加到.nuget \\ NuGet.config中的disabledPackageSources部分中。 I just had to remove it from the disabled list.
我只需要从禁用列表中将其删除。
<disabledPackageSources>
<add key="RaNuget" value="true" />
</disabledPackageSources>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.