Xamarin NuGet在添加新包时使用无效提要

Xamarin NuGet在添加新包时使用无效提要,xamarin,nuget,Xamarin,Nuget,我一直在使用NuGet的公共和私有提要,并将它们添加到项目根目录中的NuGet.Config文件中: 运行nuget restore可以很好地恢复nuget.org和my private feed中的包,但是在尝试从nuget.org添加新的nuget时,它失败了,因为它使用的是private feed而不是nuget.org。我一直试图通过nuget install从VisualStudio(Mac)和命令行添加它,但同样的事情发生了 输出如下所示: Feeds used: https

我一直在使用NuGet的公共和私有提要,并将它们添加到项目根目录中的
NuGet.Config
文件中:


运行
nuget restore
可以很好地恢复nuget.org和my private feed中的包,但是在尝试从nuget.org添加新的nuget时,它失败了,因为它使用的是private feed而不是nuget.org。我一直试图通过
nuget install
从VisualStudio(Mac)和命令行添加它,但同样的事情发生了

输出如下所示:

Feeds used:
  https://api.nuget.org/v3/index.json
  http://privatefeed.local:9011/api/v3/index.json

Installing package 'Polly' to '/Users/user/Documents/MyProject'.
  CACHE https://api.nuget.org/v3/registration4-gz-semver2/polly/index.json
  GET http://privatefeed.local:9011/api/v3/registration/polly/index.json
An error was encountered when fetching 'GET http://privatefeed.local:9011/api/v3/registration/polly/index.json'. The request will now be retried.
mono-io-layer-error (-1)
  GET http://privatefeed.local:9011/api/v3/registration/polly/index.json
An error was encountered when fetching 'GET http://privatefeed.local:9011/api/v3/registration/polly/index.json'. The request will now be retried.
mono-io-layer-error (-1)
  GET http://privatefeed.local:9011/api/v3/registration/polly/index.json
An error occurred while retrieving package metadata for 'Polly' from source 'ligetFeed'.
  mono-io-layer-error (-1)

注意,它试图使用
GEThttp://privatefeed.local:9011/api/v3/registration/polly/index.json
而不是
api.nuget.org

是否需要额外的步骤?NuGet如何决定使用哪个提要


注意:通过从
Nuget.Config
中删除私有提要条目,添加包,然后重新添加提要并恢复,我成功地添加了包,但从长远来看,这似乎并不正确

不幸的是,无法为提要设置可选优先级来解决该问题。我希望可以按如下方式进行:

<packageSources>
    <!-- Internal package source comes before NuGet.org proxy -->   
    <add key="my_private_feed" value="http://internal-server:8081/repository/private_feed1/" priority="1" />
    <add key="cache_nugetorg" value="https://www.nuget.org/api/v2/" priority="2" />
</packageSources> 
然而,这种方式也无法实现。我还发现,有人提出了优先权方法作为建议


最后,我希望将来能有这样的方法。

结果是mono和MDN(.local)都有问题。我一直在使用Mac OS作为LiGet的Nuget提要,您可能知道,您可以使用IP或
name.local
访问网络上的任何其他Mac,就像我使用
graymini.local

从中替换提要
NuGet.Config



一切似乎都很好。尝试从私有提要获取新包将返回
NotFound
,而不是使用
mono-io-layer error
出错,并且它将继续从nuget.org精细获取它

  GET https://api.nuget.org/v3/registration4-gz-semver2/polly/index.json
  GET http://22.33.444.555:9011/api/v3/registration/polly/index.json
  NOTFOUND http://22.33.444.555:9011/api/v3/registration/polly/index.json 
  OK https://api.nuget.org/v3/registration4-gz-semver2/polly/index.json 

您好,您是否先将其发布到nuget.org?我尝试添加的nuget存在于nuget.org()上,但问题是“nuget安装”使用了错误的源。它没有试图从nuget.org获取它,而是从我的私有提要获取它,即使两者在nuget.Config中都被指定为packageSourcesOkey,如果从
packageSources
中删除
ligetFeed
,是否可以成功安装
Polly
,但我真的不知道nuget如何选择每个包使用哪个提要,或者我是否可以指定每个包使用哪个提要。类似于
package1->nuget.org
package2->privateFeed
,等等。由于同样的问题,nuget使用了错误的提要,在还原过程中或尝试更新包时,我偶尔也会遇到错误,但在
dotnet还原后,这些错误似乎会消失。但是,添加新包的情况不同,它将继续失败
  GET https://api.nuget.org/v3/registration4-gz-semver2/polly/index.json
  GET http://22.33.444.555:9011/api/v3/registration/polly/index.json
  NOTFOUND http://22.33.444.555:9011/api/v3/registration/polly/index.json 
  OK https://api.nuget.org/v3/registration4-gz-semver2/polly/index.json