.net core 私有nuget包的dotnet还原失败

.net core 私有nuget包的dotnet还原失败,.net-core,nuget,ubuntu-16.04,.net Core,Nuget,Ubuntu 16.04,我在windows中开发了一个web api(.net内核),并将其托管在ubuntu服务器上。我的应用程序需要来自私有nuget存储库的包。 我已经将包源代码设置为numget config-set RepoName=http://sample-nuget-repo.net/api/odata。 我已经用nuget资源进行了验证。 当我运行dotnetrestore时,它会向我发送失败消息。 如果我遗漏了什么,请帮助我 nuget.config文件在ubuntu中的位置是什么(在windows

我在windows中开发了一个web api(.net内核),并将其托管在ubuntu服务器上。我的应用程序需要来自私有nuget存储库的包。 我已经将包源代码设置为
numget config-set RepoName=http://sample-nuget-repo.net/api/odata
。 我已经用nuget资源进行了验证。 当我运行dotnetrestore时,它会向我发送失败消息。 如果我遗漏了什么,请帮助我


nuget.config文件在ubuntu中的位置是什么(在windows中是appdata/nuget/nuget.config)

您可以在包含源代码的源代码管理存储库根目录中的nuget.config文件中定义自定义包源代码。那么您就不需要在每台机器上都配置它了

NuGet.Config:

<configuration>
    <packageSources>
        <add key="NuGet.org" value="https://api.nuget.org/v3/index.json" />
        <add key="sample-nuget-repo" value="http://sample-nuget-repo.net/api/odata" />
    </packageSources>
</configuration>


运行
nuget restore solution.sln
dotnet restore solution.sln
时,将首先检查解决方案的目录中是否有nuget.Config文件,然后检查上面的目录,直到返回根目录。最后,将检查用户配置文件下的NuGet.Config。

dotnet restore app.sln--源代码解决了我的问题我们可以全局配置吗?谢谢Matt。是,nuget包源存储在windows中的nuget.config中。也是在linux上创建的nuget.config。如果是,此文件的位置是什么?您可以在任何平台(Linux、Mac和Windows)上使用NuGet.Config文件。您只需要使用源代码创建它,这样它是独立的,不需要在构建服务器上进行额外设置)。如果要在生成服务器上单独配置,则需要在~/.config/NuGet/NuGet.config文件中添加此信息,或使用
NuGet
本身在生成脚本中添加此包源。