title: Issue restoring local NuGet package through Azure Pipelines
body: <p>I have come across an issue in Azure Pipelines where I have a local NuGet package in my repo that I wish to include in the pipelines build alongside all other NuGet packages (which are all picked up from nuget.org normally). My project is built on ASP.NET Core, more specifically it is a Blazor server-side web application.</p>
  <p>The local NuGet package &quot;Breeze.Sharp.0.9.6.nupkg&quot; is stored in my repo under: <strong>MySolution/packages</strong></p>
  <p>What is happening is that the nuget.org packages restore OK in pipelines but it fails when it tries to find my local NuGet package location and throws the below error:</p>
  <pre><code>     1&gt;/usr/share/dotnet/sdk/3.1.402/NuGet.targets(128,5): error : The local source '/home/vsts/work/1/Nuget/MySolution/packages' doesn't exist. [/home/vsts/work/1/s/MySolution/MySolution.sln]
           NuGet.Protocol.Core.Types.FatalProtocolException: The local source '/home/vsts/work/1/Nuget/MySolution/packages' doesn't exist.
              at NuGet.Protocol.LocalV3FindPackageByIdResource.GetVersionsCore(String id, ILogger logger)
              at NuGet.Protocol.LocalV3FindPackageByIdResource.&lt;&gt;c__DisplayClass22_0.&lt;GetVersions&gt;b__0(String keyId)
              at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
              at NuGet.Protocol.LocalV3FindPackageByIdResource.GetVersions(String id, SourceCacheContext cacheContext, ILogger logger)
              at NuGet.Protocol.LocalV3FindPackageByIdResource.GetAllVersionsAsync(String id, SourceCacheContext cacheContext, ILogger logger, CancellationToken cancellationToken)
              at NuGet.Commands.SourceRepositoryDependencyProvider.GetAllVersionsAsync(String id, SourceCacheContext cacheContext, ILogger logger, CancellationToken cancellationToken)
              at NuGet.Commands.SourceRepositoryDependencyProvider.FindLibraryCoreAsync(LibraryRange libraryRange, SourceCacheContext cacheContext, ILogger logger, CancellationToken cancellationToken)
              at NuGet.Commands.SourceRepositoryDependencyProvider.&lt;&gt;c__DisplayClass19_0.&lt;&lt;FindLibraryAsync&gt;b__0&gt;d.MoveNext()
           --- End of stack trace from previous location where exception was thrown ---
              at NuGet.Commands.SourceRepositoryDependencyProvider.FindLibraryAsync(LibraryRange libraryRange, NuGetFramework targetFramework, SourceCacheContext cacheContext, ILogger logger, CancellationToken cancellationToken)
              at NuGet.DependencyResolver.ResolverUtility.&lt;&gt;c__DisplayClass9_1.&lt;&lt;FindLibraryFromSourcesAsync&gt;b__0&gt;d.MoveNext()
           --- End of stack trace from previous location where exception was thrown ---
              at NuGet.DependencyResolver.ResolverUtility.FindLibraryFromSourcesAsync(LibraryRange libraryRange, IEnumerable`1 providers, Func`2 action)
              at NuGet.DependencyResolver.ResolverUtility.FindLibraryByVersionAsync(LibraryRange libraryRange, NuGetFramework framework, IEnumerable`1 providers, SourceCacheContext cacheContext, ILogger logger, CancellationToken token)
              at NuGet.DependencyResolver.ResolverUtility.FindPackageLibraryMatchAsync(LibraryRange libraryRange, NuGetFramework framework, IEnumerable`1 remoteProviders, IEnumerable`1 localProviders, SourceCacheContext cacheContext, ILogger logger, CancellationToken cancellationToken)
              at NuGet.DependencyResolver.ResolverUtility.FindLibraryMatchAsync(LibraryRange libraryRange, NuGetFramework framework, String runtimeIdentifier, IEnumerable`1 remoteProviders, IEnumerable`1 localProviders, IEnumerable`1 projectProviders, IDictionary`2 lockFileLibraries, SourceCacheContext cacheContext, ILogger logger, CancellationToken cancellationToken)
              at NuGet.DependencyResolver.ResolverUtility.FindLibraryEntryAsync(LibraryRange libraryRange, NuGetFramework framework, String runtimeIdentifier, RemoteWalkContext context, CancellationToken cancellationToken)
              at NuGet.DependencyResolver.RemoteDependencyWalker.CreateGraphNode(LibraryRange libraryRange, NuGetFramework framework, String runtimeName, RuntimeGraph runtimeGraph, Func`2 predicate, GraphEdge`1 outerEdge, TransitiveCentralPackageVersions transitiveCentralPackageVersions)
              at NuGet.DependencyResolver.RemoteDependencyWalker.CreateGraphNode(LibraryRange libraryRange, NuGetFramework framework, String runtimeName, RuntimeGraph runtimeGraph, Func`2 predicate, GraphEdge`1 outerEdge, TransitiveCentralPackageVersions transitiveCentralPackageVersions)
              at NuGet.DependencyResolver.RemoteDependencyWalker.WalkAsync(LibraryRange library, NuGetFramework framework, String runtimeIdentifier, RuntimeGraph runtimeGraph, Boolean recursive)
              at NuGet.Commands.ProjectRestoreCommand.WalkDependenciesAsync(LibraryRange projectRange, NuGetFramework framework, String runtimeIdentifier, RuntimeGraph runtimeGraph, RemoteDependencyWalker walker, RemoteWalkContext context, CancellationToken token)
              at NuGet.Commands.ProjectRestoreCommand.TryRestoreAsync(LibraryRange projectRange, IEnumerable`1 frameworkRuntimePairs, NuGetv3LocalRepository userPackageFolder, IReadOnlyList`1 fallbackPackageFolders, RemoteDependencyWalker remoteWalker, RemoteWalkContext context, Boolean forceRuntimeGraphCreation, CancellationToken token, TelemetryActivity telemetryActivity)
              at NuGet.Commands.RestoreCommand.ExecuteRestoreAsync(NuGetv3LocalRepository userPackageFolder, IReadOnlyList`1 fallbackPackageFolders, RemoteWalkContext context, CancellationToken token, TelemetryActivity telemetryActivity)
              at NuGet.Commands.RestoreCommand.ExecuteAsync(CancellationToken token)
              at NuGet.Commands.RestoreRunner.ExecuteAsync(RestoreSummaryRequest summaryRequest, CancellationToken token)
              at NuGet.Commands.RestoreRunner.ExecuteAndCommitAsync(RestoreSummaryRequest summaryRequest, CancellationToken token)
              at NuGet.Commands.RestoreRunner.CompleteTaskAsync(List`1 restoreTasks)
              at NuGet.Commands.RestoreRunner.RunAsync(IEnumerable`1 restoreRequests, RestoreArgs restoreContext, CancellationToken token)
              at NuGet.Commands.RestoreRunner.RunAsync(RestoreArgs restoreContext, CancellationToken token)
              at NuGet.Build.Tasks.BuildTasksUtility.RestoreAsync(DependencyGraphSpec dependencyGraphSpec, Boolean interactive, Boolean recursive, Boolean noCache, Boolean ignoreFailedSources, Boolean disableParallel, Boolean force, Boolean forceEvaluate, Boolean hideWarningsAndErrors, Boolean restorePC, Boolean cleanupAssetsForUnsupportedProjects, ILogger log, CancellationToken cancellationToken)
              at NuGet.Build.Tasks.RestoreTask.ExecuteAsync(ILogger log)
         Done executing task &quot;RestoreTask&quot; -- FAILED.
       1&gt;Done building target &quot;Restore&quot; in project &quot;MySolution.sln&quot; -- FAILED.
       1&gt;Done Building Project &quot;/home/vsts/work/1/s/MySolution/MySolution.sln&quot; (Restore target(s)) -- FAILED.
  
  Build FAILED.
  
         &quot;/home/vsts/work/1/s/MySolution/MySolution.sln&quot; (Restore target) (1) -&gt;
         (Restore target) -&gt; 
  
  
  </code></pre>
  <p>My first thoughts were the same as anyone elses... <strong>AH</strong> the path must be incorrect! However... I cannot seem to get it to work after trying various different paths to get to the packages folder to pick up my local NuGet package.</p>
  <p>To assist, my config files are below.</p>
  <p><strong>azure-pipelines.yml:</strong></p>
  <pre><code>trigger:
  - master
  
  pool:
    vmImage: 'ubuntu-latest'
  
  variables:
    buildConfiguration: 'Release'
  
  steps:   
  - task: NuGetToolInstaller@1
    displayName: 'Use NuGet 4.9.1'
    inputs:
      versionSpec: 4.9.1
  
  - task: DotNetCoreCLI@2
    displayName: 'Restore NuGet Packages'
    inputs:
      command: 'restore'
      projects: '**/*.sln'
      feedsToUse: 'config'
      nugetConfigPath: 'MySolution/NuGet.Config'
  
  - task: DotNetCoreCLI@2
    displayName: 'Build web project'
    inputs:
      command: 'build'
      projects: $(SolutionPath)
      
  </code></pre>
  <p><strong>NuGet.Config:</strong></p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;configuration&gt;
      &lt;packageSources&gt;
          &lt;clear /&gt;
          &lt;add key=&quot;nuget.org&quot; value=&quot;https://api.nuget.org/v3/index.json&quot; protocolVersion=&quot;3&quot; /&gt;
          &lt;add key=&quot;LocalPackages&quot; value=&quot;MySolution/packages&quot; /&gt;
      &lt;/packageSources&gt;
  &lt;/configuration&gt;
  </code></pre>
  <p>The part in question I have been messing about with is the &quot;LocalPackages&quot; element which is where I thought the issue could be, so have been trying all sorts of combinations of paths to try and narrow it down - but no luck - which has made me think this <em><strong>could</strong></em> be a red herring, but you never know I could be doing something stupid!</p>
  <p>I understand there are best practices which can be followed here such as creating my own Artifacts feed of NuGet packages for maintainability, but this is going to be a refinement phase later for me, my focus at the moment is just to simply get the pipeline in a build state ready for deployment and testing.</p>
  <p>Any help or guidance on this or things I can try to fix this would be greatly appreciated!</p>
  <p>Let me know if more specific info is needed and I can provide!</p>
  <p>Thank you.</p>