如何在.NET Core上注册新的NuGet包源?

Vik*_*kto 7 .net c# package nuget .net-core

我正在努力添加新的NuGet源来存储私有软件包。我已经尝试过将配置添加到我的.csproj中,如这篇文章所示

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
    <add key="Artifactory-DEV" value="https://theluggage-agct.gray.net/artifactory/api/nuget/nuget-institutional-development-local" protocolVersion="3"/>
  </packageSources>
</configuration>
Run Code Online (Sandbox Code Playgroud)

也尝试过此操作,但在中找不到等效项dotnet nuget

nuget源添加-名称“ MyServer”-源\ myserver \ packages

OBS:我未使用Visual Studio 2017,当前正在使用Ubuntu。

ziv*_*kan 8

可惜的是,用户ffa没有发布他们的评论作为答案,因为它是正确的。该XML应该位于名为的文件中nuget.config

另外,如果您安装了新的dotnet SDK / CLI,则也可以运行dotnet new nugetconfig,它将从基本模板为您创建文件。NuGet文档提供了一些有关如何根据需要应用设置的信息,但是通常人们将nuget.config文件放在其存储库的根目录中或与.sln文件相同的位置。

  • 我只是讨厌“不,不会工作”作为答案(尽管您说对了我是对的):-) (2认同)