Base solution for your next web application
Open Closed

How to update all latest nuget packages at once #611


User avatar
0
sampath created

Could you tell me how to update all the 'ASP.NET Boilerplate Nuget Packages' at once ? Let's say on the latest release where it's having around 10 Nugets. So without updating them one by one where is there any method to update them all at once ? Thanks in advance.


7 Answer(s)
  • User Avatar
    0
    hikalkan created
    Support Team

    I don't know if Visual Studio supports this. I also do it by hand :( But nuget command line may support this. You can check it's docs.

  • User Avatar
    0
    scorpion86 created

    Just use Visual Studio 2015 update 1. Nuget have update all functionality.

  • User Avatar
    0
    hikalkan created
    Support Team

    Visual Studio 2013 has too "update all".

  • User Avatar
    0
    daws created

    to update all Abp* packages from nuget console :

    ForEach($project in get-project -all) { ForEach($package in Get-Package -ProjectName $project.ProjectName | ?{ $_.Id -like 'Abp*'}) { Update-Package -ProjectName $project.ProjectName -Id $package.Id;} }
    
  • User Avatar
    0
    hikalkan created
    Support Team

    Thank you for this magical code :)

    We had written this before:

    get-project -all | get-package | ?{ $_.Id -like 'Abp*' } | update-package
    

    (<a class="postlink" href="http://www.aspnetboilerplate.com/Pages/Documents/Nuget-Packages#tips">http://www.aspnetboilerplate.com/Pages/ ... kages#tips</a>)

    What's the different from the code you have shared.

  • User Avatar
    0
    daws created

    i didn't saw that it was already on the documentation :mrgreen: Well, that's not my creation, it's from another developer :oops:

    it appears that : (source [https://coderwall.com/p/gvrn4w/update-all-nuget-packages-in-a-solution-matched-by-name]))

    ForEach($project in get-project -all) { ForEach($package in Get-Package -ProjectName $project.ProjectName | ?{ $_.Id -like 'Abp*'}) { Update-Package -ProjectName $project.ProjectName -Id $package.Id;} }
    

    is faster to execute than : (source [https://coderwall.com/p/wtobfg/update-all-nuget-packages-in-a-solution-matched-by-name--2]))

    get-project -all | get-package | ?{ $_.Id -like 'Abp*' } | update-package
    

    by avoiding unecessary check.

    The complexity of the original one is too big as it tries to update all packages found for all projects, instead of just the packages present on each project.

    the current one works fine, but i've already 28 projects in my solution, so it takes a lot of time ;)

  • User Avatar
    0
    hikalkan created
    Support Team

    So, you say that this is faster:

    ForEach($project in get-project -all) { ForEach($package in Get-Package -ProjectName $project.ProjectName | ?{ $_.Id -like 'Abp*'}) { Update-Package -ProjectName $project.ProjectName -Id $package.Id;} }

    Let us try it and update the documentation. Created an issue: <a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/issues/1379">https://github.com/aspnetboilerplate/as ... ssues/1379</a>