'NuGet "Unable to find package" for local source

This has worked previously, and now it doesn't. Maybe because I upgraded Visual Studio to 15.7.4, maybe because I completely replaced the project that provides the local package source, maybe ... yes, who knows?

Here's the setup for my local source. (I've temporarily deselected nuget.org to try to reduce confusion - in vain.)

enter image description here

The path to the local NuGet package must be correct because when I select my local package source the package gets displayed with the correct version info.

enter image description here

But when I select a project and click Install it displays the following output:

Restoring packages for E:\Roslyn\35607\Current\src\Compilers\Core\Portable\CodeAnalysis.csproj...
  GET https://dotnetmyget.blob.core.windows.net/artifacts/dotnet-coreclr/nuget/v3/flatcontainer/merlinia.yackscore/index.json
  GET https://dotnetmyget.blob.core.windows.net/artifacts/dotnet-core/nuget/v3/flatcontainer/merlinia.yackscore/index.json
  NotFound https://dotnetmyget.blob.core.windows.net/artifacts/dotnet-coreclr/nuget/v3/flatcontainer/merlinia.yackscore/index.json 826ms
  NotFound https://dotnetmyget.blob.core.windows.net/artifacts/dotnet-core/nuget/v3/flatcontainer/merlinia.yackscore/index.json 772ms
  GET https://dotnetmyget.blob.core.windows.net/artifacts/dotnet-corefxtestdata/nuget/v3/flatcontainer/merlinia.yackscore/index.json
  GET https://dotnetmyget.blob.core.windows.net/artifacts/dotnet-buildtools/nuget/v3/flatcontainer/merlinia.yackscore/index.json
  NotFound https://dotnetmyget.blob.core.windows.net/artifacts/dotnet-corefxtestdata/nuget/v3/flatcontainer/merlinia.yackscore/index.json 799ms
  NotFound https://dotnetmyget.blob.core.windows.net/artifacts/dotnet-buildtools/nuget/v3/flatcontainer/merlinia.yackscore/index.json 810ms
  GET https://dotnetmyget.blob.core.windows.net/artifacts/symreader/nuget/v3/flatcontainer/merlinia.yackscore/index.json
  GET https://dotnetmyget.blob.core.windows.net/artifacts/symreader-portable/nuget/v3/flatcontainer/merlinia.yackscore/index.json
  NotFound https://dotnetmyget.blob.core.windows.net/artifacts/symreader/nuget/v3/flatcontainer/merlinia.yackscore/index.json 1000ms
  GET https://dotnetmyget.blob.core.windows.net/artifacts/symreader-converter/nuget/v3/flatcontainer/merlinia.yackscore/index.json
  NotFound https://dotnetmyget.blob.core.windows.net/artifacts/symreader-portable/nuget/v3/flatcontainer/merlinia.yackscore/index.json 893ms
  NotFound https://dotnetmyget.blob.core.windows.net/artifacts/symreader-converter/nuget/v3/flatcontainer/merlinia.yackscore/index.json 798ms
  GET https://dotnetmyget.blob.core.windows.net/artifacts/symreader-native/nuget/v3/flatcontainer/merlinia.yackscore/index.json
  NotFound https://dotnetmyget.blob.core.windows.net/artifacts/symreader-native/nuget/v3/flatcontainer/merlinia.yackscore/index.json 791ms
  GET https://dotnetmyget.blob.core.windows.net/artifacts/metadata-tools/nuget/v3/flatcontainer/merlinia.yackscore/index.json
  NotFound https://dotnetmyget.blob.core.windows.net/artifacts/metadata-tools/nuget/v3/flatcontainer/merlinia.yackscore/index.json 869ms
  GET https://dotnetmyget.blob.core.windows.net/artifacts/interactive-window/nuget/v3/flatcontainer/merlinia.yackscore/index.json
  GET https://dotnetmyget.blob.core.windows.net/artifacts/roslyn-master-nightly/nuget/v3/flatcontainer/merlinia.yackscore/index.json
  NotFound https://dotnetmyget.blob.core.windows.net/artifacts/interactive-window/nuget/v3/flatcontainer/merlinia.yackscore/index.json 851ms
  GET https://dotnetmyget.blob.core.windows.net/artifacts/roslyn-tools/nuget/v3/flatcontainer/merlinia.yackscore/index.json
  NotFound https://dotnetmyget.blob.core.windows.net/artifacts/roslyn-master-nightly/nuget/v3/flatcontainer/merlinia.yackscore/index.json 1016ms
  GET https://dotnetmyget.blob.core.windows.net/artifacts/roslyn-analyzers/nuget/v3/flatcontainer/merlinia.yackscore/index.json
  NotFound https://dotnetmyget.blob.core.windows.net/artifacts/roslyn-tools/nuget/v3/flatcontainer/merlinia.yackscore/index.json 798ms
  GET https://dotnetmyget.blob.core.windows.net/artifacts/roslyn/nuget/v3/flatcontainer/merlinia.yackscore/index.json
  NotFound https://dotnetmyget.blob.core.windows.net/artifacts/roslyn-analyzers/nuget/v3/flatcontainer/merlinia.yackscore/index.json 858ms
  GET https://www.myget.org/F/vs-devcore/api/v3/flatcontainer/merlinia.yackscore/index.json
  GET https://www.myget.org/F/vs-editor/api/v3/flatcontainer/merlinia.yackscore/index.json
  NotFound https://www.myget.org/F/vs-devcore/api/v3/flatcontainer/merlinia.yackscore/index.json 161ms
  NotFound https://www.myget.org/F/vs-editor/api/v3/flatcontainer/merlinia.yackscore/index.json 125ms
  NotFound https://dotnetmyget.blob.core.windows.net/artifacts/roslyn/nuget/v3/flatcontainer/merlinia.yackscore/index.json 763ms
  GET https://ddmygetsg2.blob.core.windows.net/artifacts/vssdk/nuget/v3/flatcontainer/merlinia.yackscore/index.json
  GET https://ddmygetsg2.blob.core.windows.net/artifacts/vs-impl/nuget/v3/flatcontainer/merlinia.yackscore/index.json
  NotFound https://ddmygetsg2.blob.core.windows.net/artifacts/vssdk/nuget/v3/flatcontainer/merlinia.yackscore/index.json 823ms
  GET https://api.nuget.org/v3-flatcontainer/merlinia.yackscore/index.json
  NotFound https://api.nuget.org/v3-flatcontainer/merlinia.yackscore/index.json 754ms
  NotFound https://ddmygetsg2.blob.core.windows.net/artifacts/vs-impl/nuget/v3/flatcontainer/merlinia.yackscore/index.json 996ms
NU1101: Unable to find package Merlinia.YacksCore. No packages exist with this id in source(s): https://api.nuget.org/v3/index.json, https://dotnet.myget.org/F/dotnet-buildtools/api/v3/index.json, https://dotnet.myget.org/F/dotnet-core/api/v3/index.json, https://dotnet.myget.org/F/dotnet-coreclr/api/v3/index.json, https://dotnet.myget.org/F/dotnet-corefxtestdata/api/v3/index.json, https://dotnet.myget.org/F/interactive-window/api/v3/index.json, https://dotnet.myget.org/F/metadata-tools/api/v3/index.json, https://dotnet.myget.org/F/roslyn-analyzers/api/v3/index.json, https://dotnet.myget.org/F/roslyn-master-nightly/api/v3/index.json, https://dotnet.myget.org/F/roslyn-tools/api/v3/index.json, https://dotnet.myget.org/F/roslyn/api/v3/index.json, https://dotnet.myget.org/F/symreader-converter/api/v3/index.json, https://dotnet.myget.org/F/symreader-native/api/v3/index.json, https://dotnet.myget.org/F/symreader-portable/api/v3/index.json, https://dotnet.myget.org/F/symreader/api/v3/index.json, https://myget.org/F/vs-devcore/api/v3/index.json, https://myget.org/F/vs-editor/api/v3/index.json, https://vside.myget.org/F/vs-impl/api/v3/index.json, https://vside.myget.org/F/vssdk/api/v3/index.json
Package restore failed. Rolling back package changes for 'CodeAnalysis'.
Time Elapsed: 00:00:15.5163462
========== Finished ==========

I can't understand why NuGet is looking in so many strange places for my package, and I can't understand why it doesn't look for it in the local folder where it is located. (And as I mention above, this was working until today.)

By the way, I have tried using "Clear All NuGet Cache(s)", and I have restarted my PC.

EDIT:

If I use the Package Manager Console and enter this command:

install-package merlinia.yackscore -source "E:\Yacks\YacksCore\YacksCore\bin\Debug\"

I get this error message:

The 'Source' parameter is not respected for the transitive package management based project(s) CodeAnalysis. The enabled sources in your NuGet configuration will be used.

And when I look in the file C:\Users\rp\AppData\Roaming\NuGet\NuGet.Config I see this, which looks correct to me:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="YacksCore" value="E:\Yacks\YacksCore\YacksCore\bin\Debug\" />
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
  </packageSources>
  <disabledPackageSources>
    <add key="nuget.org" value="true" />
    <add key="Microsoft Visual Studio Offline Packages" value="true" />
    <add key="Microsoft and .NET" value="true" />
  </disabledPackageSources>
  <packageRestore>
    <add key="enabled" value="True" />
    <add key="automatic" value="True" />
  </packageRestore>
  <bindingRedirects>
    <add key="skip" value="False" />
  </bindingRedirects>
  <packageManagement>
    <add key="format" value="1" />
    <add key="disabled" value="False" />
  </packageManagement>
</configuration>

I really hope that someone can tell me what's wrong.

EDIT 2:

Here's the .csproj file for one of the projects where I'm unable to get it to accept my local NuGet package, just in case this helps.

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c)  Microsoft.  All Rights Reserved.  Licensed under the Apache License, Version 2.0.  See License.txt in the project root for license information. -->
<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <Platform Condition="'$(Platform)' == ''">AnyCPU</Platform>
    <PlatformTarget>AnyCPU</PlatformTarget>
    <OutputType>Library</OutputType>
    <RootNamespace>Microsoft.CodeAnalysis</RootNamespace>
    <AssemblyName>Microsoft.CodeAnalysis</AssemblyName>
    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
    <TargetFramework>netstandard1.3</TargetFramework>
    <ServiceablePackage>true</ServiceablePackage>
    <DefineConstants>$(DefineConstants);COMPILERCORE</DefineConstants>
    <CodeAnalysisRuleSet>..\CodeAnalysisRules.ruleset</CodeAnalysisRuleSet>
    <NoStdLib>true</NoStdLib>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
    <LangVersion>7.2</LangVersion>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'" />
  <ItemGroup>
    <Content Include="$(NuGetPackageRoot)\microsoft.diasymreader.native\$(MicrosoftDiaSymReaderNativeVersion)\runtimes\win\native\Microsoft.DiaSymReader.Native.x86.dll">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
      <Visible>false</Visible>
    </Content>
    <Content Include="$(NuGetPackageRoot)\microsoft.diasymreader.native\$(MicrosoftDiaSymReaderNativeVersion)\runtimes\win\native\Microsoft.DiaSymReader.Native.amd64.dll">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
      <Visible>false</Visible>
    </Content>
  </ItemGroup>
  <ItemGroup>
    <Compile Include="..\..\Shared\CoreClrShim.cs" Link="InternalUtilities\CoreClrShim.cs" />
    <Compile Include="..\..\Shared\DesktopShim.cs">
      <Link>DesktopShim.cs</Link>
    </Compile>
    <Compile Update="CodeAnalysisResources.Designer.cs">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>CodeAnalysisResources.resx</DependentUpon>
    </Compile>
  </ItemGroup>
  <ItemGroup>
    <PackageReference Include="LiteDB" Version="4.1.3" />
    <PackageReference Include="Microsoft.DiaSymReader.Native" Version="$(MicrosoftDiaSymReaderNativeVersion)" />
    <PackageReference Include="System.Diagnostics.FileVersionInfo" Version="$(SystemDiagnosticsFileVersionInfoVersion)" />
    <PackageReference Include="System.Threading.Thread" Version="4.3.0" />
    <PackageReference Include="System.Xml.XmlDocument" Version="$(SystemXmlXmlDocumentVersion)" />
    <PackageReference Include="System.Xml.XPath.XDocument" Version="$(SystemXmlXPathXDocumentVersion)" />
    <PackageReference Include="System.Collections.Immutable" Version="$(SystemCollectionsImmutableVersion)" />
    <PackageReference Include="System.Reflection.Metadata" Version="$(SystemReflectionMetadataVersion)" />
    <PackageReference Include="System.Text.Encoding.CodePages" Version="$(SystemTextEncodingCodePagesVersion)" />
    <PackageReference Include="System.Threading.Tasks.Extensions" Version="$(SystemThreadingTasksExtensionsVersion)" />
    <PackageReference Include="System.ValueTuple" Version="$(SystemValueTupleVersion)" />
  </ItemGroup>
  <ItemGroup>
    <InternalsVisibleTo Include="Microsoft.CodeAnalysis.CSharp" />
    <InternalsVisibleTo Include="Microsoft.CodeAnalysis.VisualBasic" />
    <InternalsVisibleTo Include="Microsoft.CodeAnalysis.ExpressionEvaluator.ExpressionCompiler" />
    <InternalsVisibleTo Include="Microsoft.CodeAnalysis.CSharp.ExpressionEvaluator.ExpressionCompiler" />
    <InternalsVisibleTo Include="Microsoft.CodeAnalysis.VisualBasic.ExpressionEvaluator.ExpressionCompiler" />
    <InternalsVisibleTo Include="csc" />
    <InternalsVisibleTo Include="csi" />
    <InternalsVisibleTo Include="Microsoft.CodeAnalysis.Scripting" />
    <InternalsVisibleTo Include="Microsoft.CodeAnalysis.CSharp.Scripting" />
    <InternalsVisibleTo Include="Microsoft.CodeAnalysis.VisualBasic.Scripting" />
    <InternalsVisibleTo Include="vbc" />
    <InternalsVisibleTo Include="vbi" />
    <InternalsVisibleTo Include="Microsoft.CodeAnalysis.CompilerServer" />
    <InternalsVisibleTo Include="Microsoft.Build.Tasks.CodeAnalysis" />
    <InternalsVisibleTo Include="VBCSCompiler" />
    <InternalsVisibleTo Include="VBCSCompilerPortable" />
    <InternalsVisibleToTest Include="Roslyn.Compilers.CSharp.CommandLine.UnitTests" />
    <InternalsVisibleToTest Include="Roslyn.Compilers.CSharp.Emit.UnitTests" />
    <InternalsVisibleToTest Include="Roslyn.Compilers.CSharp.WinRT.UnitTests" />
    <InternalsVisibleToTest Include="Roslyn.Compilers.CSharp.EnC.UnitTests" />
    <InternalsVisibleToTest Include="Roslyn.Compilers.CSharp.Semantic.UnitTests" />
    <InternalsVisibleToTest Include="Roslyn.Compilers.CSharp.Symbol.UnitTests" />
    <InternalsVisibleToTest Include="Roslyn.Compilers.CSharp.Syntax.UnitTests" />
    <InternalsVisibleToTest Include="Roslyn.Compilers.CSharp.Test.Utilities" />
    <InternalsVisibleToTest Include="Roslyn.Compilers.CSharp.Test.Utilities.Desktop" />
    <InternalsVisibleToTest Include="Roslyn.Compilers.UnitTests" />
    <InternalsVisibleToTest Include="Roslyn.Compilers.VisualBasic.CommandLine.UnitTests" />
    <InternalsVisibleToTest Include="Roslyn.Compilers.VisualBasic.Emit.UnitTests" />
    <InternalsVisibleToTest Include="Roslyn.Compilers.VisualBasic.EnC.UnitTests" />
    <InternalsVisibleToTest Include="Roslyn.Compilers.VisualBasic.Semantic.UnitTests" />
    <InternalsVisibleToTest Include="Roslyn.Compilers.VisualBasic.Symbol.UnitTests" />
    <InternalsVisibleToTest Include="Roslyn.Compilers.VisualBasic.Syntax.UnitTests" />
    <InternalsVisibleToTest Include="Roslyn.Compilers.VisualBasic.Test.Utilities" />
    <InternalsVisibleToTest Include="Roslyn.DebuggerVisualizers" />
    <InternalsVisibleToTest Include="Roslyn.Diagnostics.Analyzers.FxCop.UnitTests" />
    <InternalsVisibleToTest Include="Roslyn.Diagnostics.Analyzers.UnitTests" />
    <InternalsVisibleToTest Include="Roslyn.Diagnostics.Test.Utilities" />
    <InternalsVisibleToTest Include="Roslyn.ExpressionEvaluator.CSharp.ExpressionCompiler.UnitTests" />
    <InternalsVisibleToTest Include="Roslyn.ExpressionEvaluator.VisualBasic.ExpressionCompiler.UnitTests" />
    <InternalsVisibleToTest Include="Roslyn.ExpressionEvaluator.ExpressionCompiler.Test.Utilities" />
    <InternalsVisibleToTest Include="Roslyn.InteractiveHost.UnitTests" />
    <InternalsVisibleToTest Include="Microsoft.CodeAnalysis.Scripting.UnitTests" />
    <InternalsVisibleToTest Include="Microsoft.CodeAnalysis.Scripting.Desktop.UnitTests" />
    <InternalsVisibleToTest Include="Microsoft.CodeAnalysis.CSharp.Scripting.UnitTests" />
    <InternalsVisibleToTest Include="Microsoft.CodeAnalysis.CSharp.Scripting.Desktop.UnitTests" />
    <InternalsVisibleToTest Include="Microsoft.CodeAnalysis.VisualBasic.Scripting.UnitTests" />
    <InternalsVisibleToTest Include="Microsoft.CodeAnalysis.VisualBasic.Scripting.Desktop.UnitTests" />
    <InternalsVisibleToTest Include="Roslyn.Test.Utilities.CoreClr" />
    <InternalsVisibleToTest Include="Roslyn.Test.Utilities.Desktop" />
    <InternalsVisibleToTest Include="Roslyn.Test.Utilities.FX45" />
    <InternalsVisibleToTest Include="Roslyn.Test.Utilities" />
    <InternalsVisibleToTest Include="Roslyn.Test.PdbUtilities" />
    <InternalsVisibleToTest Include="Roslyn.Compilers.CompilerServer.UnitTests" />
    <InternalsVisibleToMoq Include="DynamicProxyGenAssembly2" />
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Update="CodeAnalysisResources.resx">
      <Generator>ResXFileCodeGenerator</Generator>
      <SubType>Designer</SubType>
      <LastGenOutput>CodeAnalysisResources.Designer.cs</LastGenOutput>
    </EmbeddedResource>
    <EmbeddedResource Include="Resources\default.win32manifest" />
  </ItemGroup>
  <ItemGroup>
    <None Include="..\CodeAnalysisRules.ruleset">
      <SubType>Designer</SubType>
    </None>
    <None Include="RuleSet\RuleSetSchema.xsd">
      <SubType>Designer</SubType>
    </None>
    <PublicAPI Include="PublicAPI.Shipped.txt" />
    <PublicAPI Include="PublicAPI.Unshipped.txt" />
  </ItemGroup>
  <Import Project="..\AnalyzerDriver\AnalyzerDriver.projitems" Label="Shared" />
  <Import Project="..\..\..\Dependencies\CodeAnalysis.Debugging\Microsoft.CodeAnalysis.Debugging.projitems" Label="Shared" />
  <Import Project="..\..\..\Dependencies\PooledObjects\Microsoft.CodeAnalysis.PooledObjects.projitems" Label="Shared" />
</Project>

EDIT 3:

In the comments @MattWard suggests that my problem is related to the fact that the Visual Studio projects I'm trying to add my NuGet package to are projects that compile parts of Roslyn. But my Roslyn source files are not under version control, and not linked to the GitHub repository - they were downloaded as a .zip file specifically to avoid any side-effects from having them linked to GitHub. And the downloaded files do not include any nuget.config files.

But in searching for nuget.config files in the downloaded Roslyn source files I notice that there are two NuGet.Configuration.dll files. They are at E:\Roslyn\35607\Current\Binaries\Tools\dotnet\sdk\2.1.300-rtm-008866 (198 KB) and E:\Roslyn\35607\Current\Binaries\Tools\dotnet\sdk\2.1.300-rtm-008866\Sdks\Microsoft.NET.Sdk\tools\net46 (86 KB).

The Roslyn files were downloaded on 9 June, at a time when there were 35607 commits to Roslyn on GitHub.



Solution 1:[1]

I had this error on Visual Studio for Mac. After I completely closed VS and reopened it, then it had no issues doing a restore.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Post Impatica