我想使用替代的nuget存储库,它需要一个apikey。
使用安装的nuget命令,我可以添加Source和Apikey
nuget sources Add -Name Artifactory -Source https://myserver/nuget/nuget
nuget setapikey <my encrypted key> -Source Artifactory
Run Code Online (Sandbox Code Playgroud)
我的第一个难题是找不到该配置的保存位置。当然不在〜/ .nuget / NuGet / NuGet.Config中
真正的问题是它仍然无法正常工作。
如果手动修改配置文件,则可以开始使用dotnet nuget [command]。这几乎可行,但是无论我做什么,apikey都不兑现。
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<config>
<add key="DefaultPushSource" value="https://myserver/api/nuget/nuget" />
</config>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
<add key="Artifactory" value="https://myserver/api/nuget/nuget" />
</packageSources>
<apikeys>
<!-- tried alternating between these to no avail -->
<!--<add key="Artifactory" value="encryptedsecret" />-->
<add key="https://myserver/api/nuget/nuget" value="encryptedsecret" />
</apikeys>
</configuration>
Run Code Online (Sandbox Code Playgroud)
这几乎有效
dotnet nuget push mypkg.nupkg
>error: Encryption is not supported on non-Windows platforms.
Run Code Online (Sandbox Code Playgroud)
但是,如果我在命令行上提供apikey,它将起作用!
dotnet nuget push mypkg.nupkg -k encryptedsecret
>your package was pushed
Run Code Online (Sandbox Code Playgroud)
如何配置nuget在命令行上不要求加密机密?
我使用时配置在哪里nuget setapikey...?