2hTu2
2hTu2

Reputation: 398

nuget powershell: cant run build independent updates

I am trying to update a package through the package manager console with a command like this:

update-package Package.Name -version 9.27

However this does not seem to work because the package has a lot of build information behind it like so:

-version 9.27.5146.3567

I would like to get the latest build version of package version 9.27 without constantly selecting the lastest build.

So far I have tried:

update-package Package.Name -version 9.27.*
update-package Package.Name -version 9.27.*.*
update-package Package.Name -version 9.27 -safe

Note: I can't just update to the latest version of Package.Name It has to be specific 9.27.[latest build]

Upvotes: 1

Views: 38

Answers (1)

marsze
marsze

Reputation: 17064

Not sure if there is an easier way, but this one-liner should work:

Update-Package Package.Name -Version ((Find-Package Package.Name -ExactMatch -AllVersions).Versions | where {$_ -like "9.27.*"} | sort | select -Last 1)

Upvotes: 1

Related Questions