gpt4 book ai didi

.net-core - 私有(private) nuget 包的 dotnet restore 失败

转载 作者:行者123 更新时间:2023-12-04 23:13:14 25 4
gpt4 key购买 nike

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

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.slndotnet restore solution.sln将首先检查解决方案的目录是否有 NuGet.Config 文件,然后是上面的目录,一直到根目录。最后将检查用户配置文件下的 NuGet.Config。

关于.net-core - 私有(private) nuget 包的 dotnet restore 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50155496/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com