NuGet“无法找到包”用于本地来源

时间:2018-06-23 09:12:43

标签: nuget

这以前曾经起作用,现在却没有。也许是因为我将Visual Studio升级到了15.7.4,也许是因为我完全替换了提供本地包源的项目,也许...是的,谁知道?

这是我本地来源的设置。 (我暂时取消选择nuget.org试图减少混乱-徒然。)

enter image description here

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

enter image description here

但是当我选择一个项目并单击Install时,它将显示以下输出:

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会在这么多奇怪的地方寻找我的包裹,也无法理解为什么它不在它所在的本地文件夹中寻找它。 (正如我上面提到的,这一直持续到今天。)

顺便说一句,我尝试使用"Clear All NuGet Cache(s)",并且重新启动了PC。

编辑:

如果我使用Package Manager Console并输入以下命令:

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>

编辑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的提交。

1 个答案:

答案 0 :(得分:0)

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