How Can I “Update-Package” to a Previous Version in the Package Manager Console?

I think I already have a solution to this so I place it here for (constructive) criticism.

function Reinstall-Package {

        [Parameter(Mandatory = $true)]

        [Parameter(Mandatory = $true)]

        [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)]


    if (-not $ProjectName) {
        $ProjectName = (get-project).ProjectName

    Uninstall-Package -ProjectName $ProjectName -Id $Id -Force:$Force
    Install-Package -ProjectName $ProjectName -Id $Id -Version $Version


This allows us to use a call such as the following to update all references to a package within the current solution.

 Get-Project -All |
     ?{ $_ | Get-Package | ?{ $_.Id -eq 'Foo.Bar' } } |
         %{ $_ | Reinstall-Package -Id Foo.Bar -version 1.0.0 -Force }

The -Force switch allows the package to be reinstalled even if it has dependent packages within the project.