NuGet“;找不到程序包“;本地来源

NuGet“;找不到程序包“;本地来源,nuget,Nuget,这在以前是有效的,但现在不行了。可能是因为我将Visual Studio升级到了15.7.4,可能是因为我完全替换了提供本地包源代码的项目,可能。。。是的,谁知道呢 这是我的本地源的设置。(我暂时取消了nuget.org的选择,试图减少混乱——但徒劳。) 本地NuGet包的路径必须正确,因为当我选择本地包源时,该包将显示正确的版本信息 但是,当我选择一个项目并单击“安装”时,它会显示以下输出: Restoring packages for E:\Roslyn\35607\Current\sr

这在以前是有效的,但现在不行了。可能是因为我将Visual Studio升级到了15.7.4,可能是因为我完全替换了提供本地包源代码的项目,可能。。。是的,谁知道呢

这是我的本地源的设置。(我暂时取消了nuget.org的选择,试图减少混乱——但徒劳。)

本地NuGet包的路径必须正确,因为当我选择本地包源时,该包将显示正确的版本信息

但是,当我选择一个项目并单击“安装”时,它会显示以下输出:

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 ==========
我不明白为什么NuGet在这么多奇怪的地方寻找我的包,我也不明白为什么它不在它所在的本地文件夹中寻找它。(正如我上面提到的,这项工作一直持续到今天。)

顺便说一下,我尝试过使用
“清除所有NuGet缓存”
,并且重新启动了电脑

编辑:

如果我使用包管理器控制台并输入以下命令:

install-package merlinia.yackscore -source "E:\Yacks\YacksCore\YacksCore\bin\Debug\"
我收到以下错误消息:

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.
当我查看文件
C:\Users\rp\AppData\Roaming\NuGet\NuGet.Config
时,我看到了这样一个对我来说是正确的:

<?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>

我真的希望有人能告诉我怎么了

编辑2:

这是其中一个项目的.csproj文件,我无法让它接受我的本地NuGet包,以防万一这会有所帮助

<?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>

任意CPU
任意CPU
图书馆
Microsoft.CodeAnalysis
Microsoft.CodeAnalysis
真的
netstandard1.3
真的
美元(定义常量);编译核心
..\CodeAnalysisRules.ruleset
真的
7.2
保存最新
假的
保存最新
假的
desktophim.cs
真的
真的
CodeAnalysisResources.resx
ResXFileCodeGenerator
设计师
CodeAnalysisResources.Designer.cs
设计师
设计师
编辑3:

@MattWard在评论中指出,我的问题与我试图添加NuGet包的Visual Studio项目是编译Roslyn部分的项目有关。但是我的Roslyn源文件不受版本控制,也没有链接到GitHub存储库-它们是作为.zip文件下载的,专门用于避免链接到GitHub的任何副作用。下载的文件不包括任何
nuget.config
文件

但是在搜索下载的Roslyn源文件中的
nuget.config
文件时,我注意到有两个
nuget.Configuration.dll
文件。它们位于
E:\Roslyn\35607\Current\Binaries\Tools\dotnet\sdk\2.1.300-rtm-008866
(198 KB)和
E:\Roslyn\35607\Current\Binaries\Tools\dotnet\sdk\2.1.300-rtm-008866\Sdks\Microsoft.NET.sdk\Tools\net46
(86 KB)


Roslyn文件是6月9日下载的,当时GitHub上有35607个提交给Roslyn的文件。

我在Visual Studio for Mac上遇到了这个错误。在我完全关闭VS并重新打开它之后,它在执行还原时没有问题。

还原所使用的包源似乎与Visual Studio中定义的源不匹配。您的项目/解决方案是否定义了自己的NuGet.Config文件?或者它在.csproj文件中定义了包源吗?@MattWard谢谢你的评论。我简直不知道到底发生了什么事。该项目是Roslyn编译器中的项目之一。我使用NuGet的唯一原因是对.dll的一个简单的老式引用不起作用-请看这里:因此,在过去3个月左右的时间里,将NuGet与本地源一起使用是一项行之有效的工作,现在也不起作用了。我会将.csproj文件添加到我的问题中,以防其中包含一些线索。dotnet/roslyn GitHub存储库有自己的NuGet.config文件,用于清除所有全局包源-@MattWard再次感谢-我想你已经了解了一些事情。但我还是不明白,也不知道我能做些什么来解决我的问题。My Roslyn文件不受版本控制,也没有链接到GitHub存储库-它们是作为.zip文件下载的,专门用于避免链接到GitHub的任何副作用。下载的文件不包括任何nuget.config文件。我的评论空间不够了,所以我将发布一些附加信息作为对我的问题的编辑。你从哪里下载的文件?如果源代码中没有NuGet.Config文件,那么我不知道问题出在哪里。似乎您的全局~/.config/NuGet/NuGet.config文件被忽略,包还原输出表明NuGet.config文件正在某个地方执行清除操作,删除源代码,并添加一组额外的源代码。