0

I want to learn how I can run nuget update-package command as a TeamCity build step to update one package for all the projects in my solution.

I have tried using nuget installer as a step, but it didn't work. It tries to update all the package in solution ( I don't want that ), also the package I want to update comes from a TeamCity repo itself (not Nuget.org).

I have also tried adding a 'Command Line' step, but when I do so, I get that I dont have any compatible agent to run this step

%teamcity.tool.NuGet.CommandLine.2.2.1.nupkg%\tools\nuget.exe update.....

Is there any other way I can run nuget command, or am I doing anything wrong here?

Anirudh Bagri
  • 2,346
  • 1
  • 21
  • 33
  • Possible duplicate of [Nuget and Teamcity Agent not allowed to run this configuration](https://stackoverflow.com/questions/25030483/nuget-and-teamcity-agent-not-allowed-to-run-this-configuration) – Troopers Sep 28 '18 at 09:31

1 Answers1

0

Is there any other way I can run nuget command, or am I doing anything wrong here?

You can use the option Id and Source at your command line, like:

nuget.exe update -Id <YourPackageName> -Source <YourTeamCityRepo>

With those two options, you can update one package for all projects and update comes from TeamCity repo itself (not Nuget.org).

Check update command (NuGet CLI) for some more details.

Hope this helps.

Community
  • 1
  • 1
Leo Liu
  • 71,098
  • 10
  • 114
  • 135
  • Yeah! Tried this, but the problem is.. there is a bug (https://github.com/NuGet/Home/issues/6166) in nuget update command which updates all the projects in the directory not in Solution. – Anirudh Bagri Oct 10 '18 at 08:06
  • @AnirudhBagri, Have you tried specify the solution file in the command line? Like `nuget.exe update "\YourSolution.sln" -Id -Source ` – Leo Liu Oct 11 '18 at 07:35
  • Yes, I have tried that! the update command will update all the projects in the folder. I only want to update projects in my solution. – Anirudh Bagri Oct 11 '18 at 07:41
  • @AnirudhBagri, That is strange :(. How about specify the specific packages.config file? Like,`nuget.exe update "\packages.config" -Id -Source `. And you can download the new version nuget in the [nuget.org](https://www.nuget.org/downloads) instead of using nuget.exe from nuget package. – Leo Liu Oct 11 '18 at 07:44
  • I have more than 30 projects in my solution.. cant write this command for each project :(. Even the latest version has this bug..see the issue I have posted in 1st comment. – Anirudh Bagri Oct 11 '18 at 07:49