Index: NuGet/net20/Core/uninstall.ps1 ================================================================== --- NuGet/net20/Core/uninstall.ps1 +++ NuGet/net20/Core/uninstall.ps1 @@ -39,14 +39,18 @@ # than the items this script is responsible for, it must be left # alone. Furthermore, the directory (on the file system) should # be deleted if it ends up empty due to this script. # if ($folder.ProjectItems.Count -eq 0) { - $folderItems = Get-ChildItem -Path $folder.FileNames(1) -Recurse + $folderPath = $folder.FileNames(1) + + if (Test-Path $folderPath) { + $folderItems = Get-ChildItem -Path $folderPath -Recurse - if ($folderItems -eq $null) { - $folder.Delete() - } else { - $folder.Remove() + if ($folderItems -eq $null) { + $folder.Delete() + } else { + $folder.Remove() + } } } } Index: NuGet/net40/Core/uninstall.ps1 ================================================================== --- NuGet/net40/Core/uninstall.ps1 +++ NuGet/net40/Core/uninstall.ps1 @@ -39,14 +39,18 @@ # than the items this script is responsible for, it must be left # alone. Furthermore, the directory (on the file system) should # be deleted if it ends up empty due to this script. # if ($folder.ProjectItems.Count -eq 0) { - $folderItems = Get-ChildItem -Path $folder.FileNames(1) -Recurse + $folderPath = $folder.FileNames(1) + + if (Test-Path $folderPath) { + $folderItems = Get-ChildItem -Path $folderPath -Recurse - if ($folderItems -eq $null) { - $folder.Delete() - } else { - $folder.Remove() + if ($folderItems -eq $null) { + $folder.Delete() + } else { + $folder.Remove() + } } } }