Nuget VS2015 RC中的软件包管理器在安装/恢复某些软件包时失败
我正在尝试将nuget.org()中的nuget包-NGenerics.1.4.1安装到ASP.NET5项目(网站)中。包管理器失败,出现UriFormatException。之后,将引用添加到解决方案资源管理器的引用文件夹中,但带有黄色三角形(“警告”)。Nuget VS2015 RC中的软件包管理器在安装/恢复某些软件包时失败,nuget,asp.net-core,visual-studio-2015,dnx,Nuget,Asp.net Core,Visual Studio 2015,Dnx,我正在尝试将nuget.org()中的nuget包-NGenerics.1.4.1安装到ASP.NET5项目(网站)中。包管理器失败,出现UriFormatException。之后,将引用添加到解决方案资源管理器的引用文件夹中,但带有黄色三角形(“警告”)。 添加到错误列表中的错误:“依赖项NGenerics>=1.4.1.0无法解决”。 我还尝试从本地文件夹注册表安装 这里有一个错误 我想知道是否有人遇到了和我在谷歌找不到任何东西一样的问题。也欢迎任何变通方法 包管理器的输出: Install
添加到错误列表中的错误:“依赖项NGenerics>=1.4.1.0无法解决”。
我还尝试从本地文件夹注册表安装 这里有一个错误 我想知道是否有人遇到了和我在谷歌找不到任何东西一样的问题。也欢迎任何变通方法 包管理器的输出:
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.
安装NuGet软件包NGenerics.1.4.1。
已成功将“NGenerics.1.4.1”安装到Samples.AjaxDemo2。
=============已完成==========
正在还原D:\Work\Apps\Samples.AjaxDemo2\project.json的包
----------
System.UriFormatException:无效的URI:无法确定URI的格式。
在System.Uri.CreateThis(字符串Uri、布尔顿特斯卡普、UriKind)
在System.Uri..ctor处(字符串uriString)
在Microsoft.Framework.PackageManager.PackageSourceUtils.CreatePackageFeed(PackageSource源、布尔noCache、布尔ignoreFailedSources、报告)
位于Microsoft.Framework.PackageManager.RestoreCommand.AddRemoteProvidersFromSources(列出'1个remoteProviders,列出'1个有效源)
在Microsoft.Framework.PackageManager.RestoreCommand.d_u74.MoveNext()中
---来自引发异常的上一个位置的堆栈结束跟踪---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)
在System.Runtime.CompilerServices.TaskWaiter.HandleNonSuccessAndDebuggerNotification(任务任务)中
在Microsoft.Framework.PackageManager.RestoreCommand.c_udisplayClass73_0.d.MoveNext()中
---来自引发异常的上一个位置的堆栈结束跟踪---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)
在System.Runtime.CompilerServices.TaskWaiter.HandleNonSuccessAndDebuggerNotification(任务任务)中
在Microsoft.Framework.PackageManager.RestoreCommand.d_u73.MoveNext()中
----------
恢复失败
无效的URI:无法确定URI的格式。
我终于发现了问题所在。我在文件夹结构中的解决方案上方某处有“.nuget\nuget.config”文件。该NuGet.config包含具有相对文件路径的包源:
<configuration>
<packageSources>
<add key="local" value="..\..\..\Release"/>
</packageSources>
</configuration>
当我删除VS中的packageSource包管理器时,它开始工作
这有点可笑
希望它能帮助别人不要像我一样浪费那么多时间。我今天在Visual Studio 2013上的NuGet 2.8.5中偶然发现了同样的问题@Shrike的回答帮助我找到了自定义NuGet.config中的相对路径规范。由于它似乎是
System.Uri
必须能够解析它,所以您所要做的就是确保相对路径是正确的合法Uri。相对文件URI必须以“./”开头(obv也不使用反斜杠,它们是Windows的东西!)。看
例如,使用:
<add key="local-feed" value="./lib/nuget-feed" />
而不是:
<add key="local-feed" value="lib/nuget-feed" />
删除本地提要不是一个好主意,因为您现在必须从不同的提要进行恢复,这可能不是您想要的(就个人而言,鉴于nuget gallery的宕机记录,我不会把我的构建赌在它身上…)在异常上浪费了大约两个小时后,我发现我的包源已添加到.nuget\nuget.config中的disabledPackageSources部分。我只是把它从禁用列表中删除了
<disabledPackageSources>
<add key="RaNuget" value="true" />
</disabledPackageSources>