简体   繁体   English

VS2015 RC中的软件包管理器无法安装/还原某些软件包

[英]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.

相关问题 VS2015 nuget package 管理器找不到包 - VS2015 nuget package manager not finding packages VS2015 NuGet软件包管理器未加载任何在线软件包 - VS2015 NuGet package manager not loading any online packages NuGet包管理器不在VS2015上搜索或安装 - 对象引用未设置为对象的实例 - NuGet Package Manager not searching or installing on VS2015 - Object reference not set to an instance of an object 通过NuGet软件包安装软件包与vs2015中“工具”菜单中的“扩展和更新”选项有什么区别? - Whats the difference between installing a package via NuGet packages and the 'extentions and updates' option from the 'Tools' menu in vs2015? 在VS2015中获取Nuget软件包的许可证 - Get licenses for the Nuget Packages in VS2015 将 .NetStandard 2.0 Nuget 包安装到 VS2015 Net 4.6.1 项目中 - Installing a .NetStandard 2.0 Nuget package into a VS2015 Net 4.6.1 project 在VS2015中安装NuGet包时出现TFS204018错误 - TFS204018 error when installing NuGet Package in VS2015 在适用于Apache Cordova的VS2015 RC工具上使用Nuget - Using Nuget on VS2015 RC Tools for Apache Cordova 如何防止VS2015 NuGet向TFS添加包 - How to keep VS2015 NuGet from adding packages to TFS 如何为vs2015项目恢复NuGet包 - How to restore NuGet packages for vs2015 project
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM