简体   繁体   English

我可以在不使用 Nuget.exe 的情况下发布 NuGet package 吗?

[英]Can I publish a NuGet package without using Nuget.exe?

This may sound like an odd requirement, but I need to be able to push a NuGet package without using NuGet.exe.这听起来像是一个奇怪的要求,但我需要能够在不使用 NuGet.exe 的情况下推送 NuGet package。

I have a task to complete using a build agent that's normally used for docker builds;我有一个任务要使用通常用于 docker 构建的构建代理来完成; it's a Linux VM and it has almost nothing installed on it other than docker.这是一个 Linux VM,除了 docker 之外几乎没有安装任何东西。 I can create the package manually with a shell script, but I don't know how to push it to our nuget feed from a machine that doesn't have .NET installed or NuGet.exe. I can create the package manually with a shell script, but I don't know how to push it to our nuget feed from a machine that doesn't have .NET installed or NuGet.exe.

Can I simply curl the file up to the feed, somehow?我可以以某种方式简单地将文件 curl 提交到提要吗? What endpoint to I need?我需要什么端点? How are the credentials supplied?凭证是如何提供的? What's the format of the HTTP request? HTTP 请求的格式是什么?

Sure, you can use curl for that.当然,您可以为此使用curl Lets say, you are publishing your package with dotnet nuget like this:可以说,您正在使用dotnet nuget发布您的 package ,如下所示:

dotnet nuget push C:\Path\To\Package.1.2.3.nupkg --api-key 1234567890abcd --source http://localhost:44387/nuget

curl equivalent will be: curl等效值为:

curl --verbose -k -X PUT http://localhost:44387/nuget -H "X-NuGet-ApiKey: 1234567890abcd" -F "data=@C:\Path\To\Package.1.2.3.nupkg"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM