Meirion Hughes
Meirion Hughes

Reputation: 26438

Manually add a nupkg file to TeamCity Feed?

I have a TeamCity server with its Nuget feed enabled. I would like to manually add some third-party nupkg files to it. Is it possible to do so?

Upvotes: 10

Views: 3849

Answers (2)

Philip Pittle
Philip Pittle

Reputation: 12305

Your question has an ambiguous pronoun (it) so I'll answer for both case.

Is it possible to manually add a 3rd party nupkg file to a Nuget feed? Yes. Just submit the package to the feed. Either via nuget.org or if it's a private feed, to the url of the private feed. I'm guessing if this is the case, you should use a private feed. Also TeamCity has an internal NuGet feed that you can publish to directly. Read more: How to add the custom nuget feed to TeamCity build?

Is it possible to manually add a 3rd party nupkg file directly to TeamCity No. You'll need to go through a NuGet feed. That said, nuget.exe supprots setting up a local file repository, but not sure if Team City will support this syntax.

After all this, you might find it easier to just check-in your nuget packages directroy with your source code so you don't have to worry about package restore on your build server. That way you don't need to mess with any of this, just add your 3rd party nupkg files to the packages directory in your solution.


UPDATE: An alternative to adding your packages to your source control, you could setup a private NuGet feed and either host locally, or purchase one via a tool like MyGet. Then you can configure your private feed as a nuget package source within TeamCity.

Upvotes: 1

delloPiro
delloPiro

Reputation: 309

You can add nupkg to a private feed either by using the out-of-the-box TeamCity "NuGet Publish" runner type step or by using the NuGet exe.

  1. Out of the Box NuGet Publish: configure a build step with runner type "NuGet Publish". Under NuGet settings, provide the location to your .nupkg file(s) relative to checkout directory. Also supply the API key and the package source (URL to your private NuGet feed). Then run this build step and it should publish your package. It might be better to have preceding steps that rename the package to avoid confusion.

  2. CommandLine NuGet.exe: configure a build step with runner type "Command Line". Select "Executable with Parameters" under Run option. input the path to the NuGet.exe under "command executable' and add the following parameters under "command parameters"- push {Path-to-package}{Package-Name}.nupkg {API-KEY} -Source {URL-to-Private-Feed}

Upvotes: 3

Related Questions