我正在努力添加新的NuGet源来存储私有软件包。我有already tried to add config into my .csproj like this post suggests
<?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>
我also tried this,但在dotnet nuget
中找不到等效项。
nuget源添加-Name“ MyServer”-源\ myserver \ packages
OBS:我未使用Visual Studio 2017,当前正在使用Ubuntu。
答案 0 :(得分:4)
可惜的是,用户ffa没发布他们的评论作为答案,因为这是正确的。该XML应该位于名为nuget.config
的文件中。
此外,如果您安装了新的dotnet SDK / CLI,则还可以运行dotnet new nugetconfig
,它将为您从基本模板创建文件。如果您愿意的话,NuGet文档提供了有关how settings are applied的一些信息,但是通常人们将nuget.config文件放在其存储库的根目录中,或者与.sln文件放在同一位置。
答案 1 :(得分:0)
还有另一种方式。
dotnet add package <PACKAGE> -s <SOURCE>
问题在于,我每次想从某个特定的私人仓库中添加软件包时,都需要添加-s
。