如何更新以特定名称开头的解决方案中的所有NuGet包?

时间:2017-09-28 10:28:21

标签: visual-studio powershell nuget

例如,我正在寻找这样的命令,它只更新以名称SELECT t2.id, GROUP_CONCAT(t2.r ORDER BY t2.lvl DESC) FROM ( SELECT id, r, lvl FROM ( SELECT t0.r_init AS id, @r := IF(t0.reset_r = 1, t0.r_init, (select parent_id from menu where id = @r)) AS r, @l := IF(t0.reset_r = 1, 1, @l + 1) AS lvl FROM (SELECT m0.id as counter, m1.id AS r_init, ((SELECT min(id) FROM menu) = m0.id) AS reset_r FROM menu m0, menu m1 WHERE m1.id IN (25, 31, 23) ORDER BY r_init, counter ) t0 ORDER BY t0.r_init, t0.counter ) t1 WHERE r <> 0 ) t2 GROUP BY t2.id; 开头的包:

PackagePrefix

我尝试了this blog的评论部分中提供的脚本,但它引发了以下错误:

Update-Package "PackagePrefix.*"
Get-Package | Where Id -like "Contoso.*" | Sort-Object -Property Id -Unique | foreach { Update-Package $_.Id }

1 个答案:

答案 0 :(得分:0)

在摆弄一下之后,我想我正在使用一个非常旧版本的Powershell(v2.0)并基于the documentation以下脚本现在正常工作。我将Where替换为Where-Object

Get-Package | Where-Object {$_.Id -like "Contoso.*"} | Sort-Object -Property Id -Unique | foreach { Update-Package $_.Id }