专用nuget软件包的dotnet还原失败

She*_*har 4 nuget .net-core ubuntu-16.04

我在Windows中开发了一个Web api(.net核心)并将其托管在ubuntu服务器中。我的应用程序需要来自私有nuget存储库的软件包。我已将软件包源设置为nuget config -Set RepoName=http://sample-nuget-repo.net/api/odata。我已经使用nuget资源进行了验证。当我运行dotnet restore时,它会显示失败消息。如果我缺少任何东西,请帮助我。

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

Mat*_*ard 8

您可以在包含源代码的源代码控制存储库的根目录中的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>
Run Code Online (Sandbox Code Playgroud)

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