Bulk Update .NET 10 packages
Problem
When updating packages within .NET 10 or similar application, ideally there would be one command that you write that will do all the work. However, that command does not exist. At least not yet.
When you have a application and multiple class libraries, you have to go to each project folder within the solution and update each one. With Visual Studio, you get the option to right click on the solution and update all projects for the solution.
With the CLI (command line interface), that option doesn't exist. As a matter of fact, if you run the command
dotnet package update
from the folder that has your solution file, it will tell you that
$ dotnet package update
Updating outdated packages in /home/almostengr/repositories/mgm-insights.
Unsupported: Updating more than one project is not yet supported
Solution
After seeing the above message so many times, you think that there has to be an easier way. Good news is that there is an easier way.
I created a bash script in my repository that will update all of the packages with a single command. From the command line in the source code root, I run
bash ./update_packages.sh
That will call the below shell script to update all the packages.
#!/bin/bash
for directory in $(ls -1 -d Almostengr*/)
do
cd "${directory}"
dotnet package update
cd ../
done
The script is configured so that only the directories that have the
application source code are included to run the update command.
Other folders in the solution contain documentation and scripts. Thus
it is important to exclude those directories from having the command
run on them as they will produce errors.
When you run the above script, it will produce the below output.
$ bash update_packages.sh
Updating outdated packages in /home/almostengr/repositories/mgm-insights/Almostengr.CrimeMappingCom.EmailParser.
All packages are up to date
Updating outdated packages in /home/almostengr/repositories/mgm-insights/Almostengr.CrimeMappingCom.EmailParser.Worker.
All packages are up to date
Updating outdated packages in /home/almostengr/repositories/mgm-insights/Almostengr.MgmInsights.ApiClient.
All packages are up to date
Updating outdated packages in /home/almostengr/repositories/mgm-insights/Almostengr.MgmInsights.Common.
Almostengr.MgmInsights.Common:
Updating Almostengr.Common 10.2026.403.917 to 10.2026.718.2325.
warn : NU1903: Package 'System.Security.Cryptography.Xml' 8.0.2 has a known high severity vulnerability, https://github.com/advisories/GHSA-23rf-6693-g89p
warn : NU1903: Package 'System.Security.Cryptography.Xml' 8.0.2 has a known high severity vulnerability, https://github.com/advisories/GHSA-37gx-xxp4-5rgx
warn : NU1903: Package 'System.Security.Cryptography.Xml' 8.0.2 has a known high severity vulnerability, https://github.com/advisories/GHSA-6588-8gv4-xfgh
warn : NU1903: Package 'System.Security.Cryptography.Xml' 8.0.2 has a known high severity vulnerability, https://github.com/advisories/GHSA-8q5v-6pqq-x66h
warn : NU1903: Package 'System.Security.Cryptography.Xml' 8.0.2 has a known high severity vulnerability, https://github.com/advisories/GHSA-cvvh-rhrc-wg4q
warn : NU1903: Package 'System.Security.Cryptography.Xml' 8.0.2 has a known high severity vulnerability, https://github.com/advisories/GHSA-g8r8-53c2-pm3f
warn : NU1903: Package 'System.Security.Cryptography.Xml' 8.0.2 has a known high severity vulnerability, https://github.com/advisories/GHSA-mmjf-rqrv-855v
warn : NU1903: Package 'System.Security.Cryptography.Xml' 8.0.2 has a known high severity vulnerability, https://github.com/advisories/GHSA-w3x6-4m5h-cxqf
Updated 1 packages in 1 scanned packages.
Updating outdated packages in /home/almostengr/repositories/mgm-insights/Almostengr.MgmInsights.Web.
Almostengr.MgmInsights.Web:
Updating Almostengr.Common 10.2026.708.236 to 10.2026.718.2325.
Updating Hangfire 1.8.24 to 1.8.25.
Updating Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore 10.0.9 to 10.0.11.
Updating Microsoft.AspNetCore.Identity.EntityFrameworkCore 10.0.9 to 10.0.11.
Updating Microsoft.AspNetCore.Identity.UI 10.0.9 to 10.0.11.
Updating Microsoft.EntityFrameworkCore.Sqlite 10.0.9 to 10.0.11.
Updating Microsoft.EntityFrameworkCore.Tools 10.0.9 to 10.0.11.
Updating Square 44.0.0 to 46.1.0.
warn : NU1902: Package 'System.Data.SqlClient' 4.1.0 has a known moderate severity vulnerability, https://github.com/advisories/GHSA-8g2p-5pqh-5jmc
warn : NU1903: Package 'System.Data.SqlClient' 4.1.0 has a known high severity vulnerability, https://github.com/advisories/GHSA-98g6-xh36-x2p7
Updated 8 packages in 10 scanned packages.
Updating outdated packages in /home/almostengr/repositories/mgm-insights/Almostengr.OpenDataMontgomeryAlGov.ApiClient.
All packages are up to date
Updating outdated packages in /home/almostengr/repositories/mgm-insights/Almostengr.OpenDataMontgomeryAlGov.Worker.
All packages are up to date
As you see, the command produces output for all the solutions. Those that do not have any updates to install, will let you know that all packages are up to date. Those that do have packages to install, will perform the update of those packages.
You can modify the script to do a build after all package updates have been completed by adding
dotnet build
after the for loop in the script.