Search code examples
nugetasp.net-corevisual-studio-2015dnx

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). Package Manager fails with 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".
I also tried to install from a local folder registry.

Here's the bug on msconnect.

I wonder whether somebody experienced the same issue as I couldn't find anything in 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.

Solution

  • Finally I found out what was wrong. I had ".nuget\NuGet.config" file somewhere above of my solution in folder structure.
    That NuGet.config contained a package source with relative file path:

    <configuration>
      <packageSources>
        <add key="local" value="..\..\..\Release"/>
      </packageSources>
    </configuration>
    

    As I removed that packageSource Package Manager in VS started working.

    It's kinda ridiculous.

    Hope it helps somebody not to loose so many hours as me.