Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/spring-mvc/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 尝试从私有NuGet Repo中提取NuGet包时出现NU1100错误_C#_.net_.net Core_Nuget_.net Standard - Fatal编程技术网

C# 尝试从私有NuGet Repo中提取NuGet包时出现NU1100错误

C# 尝试从私有NuGet Repo中提取NuGet包时出现NU1100错误,c#,.net,.net-core,nuget,.net-standard,C#,.net,.net Core,Nuget,.net Standard,我有一个.NETCore2.1,它引用了一个位于私有NuGet存储库中的NuGet包 我在解决方案级别添加了一个nuget.config,它添加了私有存储库源,并通过我的dotnet restore引用了它 我得到了一个错误: 错误NU1100:无法解析“.NETCoreApp,版本2.1”的“xxx(>=x.x.x)” 从我所知道的情况来看,还原正在尝试提取该包的.NET Core 2.1版本,但该包是根据.NET标准2构建的 此外,通过VS2017添加源代码在拉包时没有任何问题 我如何告诉还

我有一个.NETCore2.1,它引用了一个位于私有NuGet存储库中的NuGet包

我在解决方案级别添加了一个
nuget.config
,它添加了私有存储库源,并通过我的
dotnet restore
引用了它

我得到了一个错误:

错误NU1100:无法解析“.NETCoreApp,版本2.1”的“xxx(>=x.x.x)”

从我所知道的情况来看,还原正在尝试提取该包的.NET Core 2.1版本,但该包是根据.NET标准2构建的

此外,通过VS2017添加源代码在拉包时没有任何问题

我如何告诉还原程序查找软件包的标准版本

编辑:

nuget.config

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <config>
    <packageSources>
      <add key="Official NuGet Feed" value="http://api.nuget.org/v3/index.json" />
      <add key="Internal NuGet Feed" value="\\{Path}\NugetPkg" />
    </packageSources>
  </config>
</configuration>

看起来是用户错误。nuget.config中的包源不应该嵌套在config xml标记下。

欢迎!请提供引用nuget的项目文件的详细信息。这是否回答了您的问题?
<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp2.1</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="______.Client" Version="0.1.8-beta" />
  </ItemGroup>

</Project>
user@desktop MINGW64 /c/Dev/TestNuget (master)
$ ls
nuget.config  TestNuget  TestNuget.sln

user@desktop MINGW64 /c/Dev/TestNuget (master)
$ dotnet build
Microsoft (R) Build Engine version 15.9.20+g88f5fadfbe for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Restoring packages for C:\Dev\TestNuget\TestNuget\TestNuget.csproj...
C:\Dev\TestNuget\TestNuget\TestNuget.csproj : error NU1101: Unable to find package ______.Client. No packages exist with this id in source(s): Microsoft Visual Studio Offline Packages, nuget.org [C:\Dev\TestNuget\TestNuget.sln]
  Restore failed in 556.43 ms for C:\Dev\TestNuget\TestNuget\TestNuget.csproj.

Build FAILED.

C:\Dev\TestNuget\TestNuget\TestNuget.csproj : error NU1101: Unable to find package ______.Client. No packages exist with this id in source(s): Microsoft Visual Studio Offline Packages, nuget.org [C:\Dev\TestNuget\TestNuget.sln]
    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:01.19

user@desktop MINGW64 /c/Dev/TestNuget (master)
$ dotnet restore
  Restoring packages for C:\Dev\TestNuget\TestNuget\TestNuget.csproj...
C:\Dev\TestNuget\TestNuget\TestNuget.csproj : error NU1101: Unable to find package ______.Client. No packages exist with this id in source(s): Microsoft Visual Studio Offline Packages, nuget.org [C:\Dev\TestNuget\TestNuget.sln]
  Restore failed in 579.86 ms for C:\Dev\TestNuget\TestNuget\TestNuget.csproj.

user@desktop MINGW64 /c/Dev/TestNuget (master)
$ dotnet restore --configfile nuget.config
  Restoring packages for C:\Dev\TestNuget\TestNuget\TestNuget.csproj...
C:\Dev\TestNuget\TestNuget\TestNuget.csproj : error NU1100: Unable to resolve '______.Client (>= 0.1.8-beta)' for '.NETCoreApp,Version=v2.1'. [C:\Dev\TestNuget\TestNuget.sln]
  Restore failed in 182 ms for C:\Dev\TestNuget\TestNuget\TestNuget.csproj.

user@desktop MINGW64 /c/Dev/TestNuget (master)
$