Skip to content
This repository was archived by the owner on Dec 18, 2017. It is now read-only.

KPM blows up if there is a nonexistent local package source #845

Closed
halter73 opened this issue Oct 31, 2014 · 0 comments
Closed

KPM blows up if there is a nonexistent local package source #845

halter73 opened this issue Oct 31, 2014 · 0 comments
Assignees
Milestone

Comments

@halter73
Copy link
Member

If you have a local package source active in NuGet.Config pointing to a directory that does not currently exist, any call to kpm restore fails with an error similar to the following:

Loaded Module: klr.core45.dll
Found DLL Export: CallApplicationMain
Information: [LoaderContainer]: Load name=Microsoft.Framework.PackageManager
Information: [PathBasedAssemblyLoader]: Loaded name=Microsoft.Framework.PackageManager in 5ms
Information: [LoaderContainer]: Load name=Microsoft.Framework.Runtime
Information: [PathBasedAssemblyLoader]: Loaded name=Microsoft.Framework.Runtime in 0ms
Information: [LoaderContainer]: Load name=Newtonsoft.Json
Information: [PathBasedAssemblyLoader]: Loaded name=Newtonsoft.Json in 1ms
Restoring packages for F:\dev\Universe\SignalR-Server\samples\SignalRSample.Web\project.json
Information: [LoaderContainer]: Load name=Microsoft.Net.Http.Client
Information: [PathBasedAssemblyLoader]: Loaded name=Microsoft.Net.Http.Client in 0ms
----------
System.IO.DirectoryNotFoundException: Could not find a part of the path 'F:\dev\SignalR\artifacts\Debug\packages'.
   at System.IO.FileSystemEnumerableIterator`1.CommonInit()
   at System.IO.FileSystemEnumerableIterator`1..ctor(String path, String originalUserPath, String searchPattern, SearchOption searchOption, SearchResultHandler`1 resultHandler)
   at System.IO.Directory.EnumerateFiles(String path, String searchPattern)
   at Microsoft.Framework.PackageManager.PackageFolderFactory.<>c__DisplayClass1.<CreatePackageFolderFromPath>b__2(String dir)
   at Microsoft.Framework.PackageManager.PackageFolderFactory.CreatePackageFolderFromPath(String path, IReport report)
   at Microsoft.Framework.PackageManager.RestoreCommand.AddRemoteProvidersFromSources(List`1 remoteProviders, List`1 effectiveSources)
   at Microsoft.Framework.PackageManager.RestoreCommand.<RestoreForProject>d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at Microsoft.Framework.PackageManager.RestoreCommand.<ExecuteCommand>d__1.MoveNext()
----------
Restore failed
Could not find a part of the path 'F:\dev\SignalR\artifacts\Debug\packages'.

In this case, I had <add key="Local SignalR" value="F:\dev\SignalR\artifacts\Debug\packages" /> in the packageSources section of my NuGet.config. When I ran kpm restore in the SignalR-Server project, I got the above error because the "F:\dev\SignalR\artifacts" didn't exist due to a git clean in the old SignalR project.

It is pretty common for me to run git clean in the old SignalR project, and in the past NuGet/kpm package restore would simply ignore the missing package source and continue restoring packages. I think this is the correct behavior. I was able to work around this issue by disabling the local package source.

I first saw this error in the 1.0.0-beta2-10660 build.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants