I'm still struggling to make this work consistently for any solution with any package source. My script (installed by a nuget package in its init.ps1 file)
param($installPath, $toolsPath, $package, $project)
$global:clidePath = $toolsPath
# We should install DevStore.vsix at this point if it's not already installed.
$manager = $packageManagerFactory.CreatePackageManager()
foreach ($name in Get-ProjectNames)
$project = Get-Project $name
$fileSys = New-Object NuGet.PhysicalFileSystem($project.Properties.Item("FullPath").Value)
$repo = new-object NuGet.PackageReferenceRepository($fileSys, $manager.LocalRepository)
foreach ($package in $repo.GetPackages())
Update-Package $package -Project $name
On a solution where I have just installed both the package providing this script and another sample one (from a local filesystem path, although the second, "Guard" exists in the online repository too), I get the following error:
Update-Package : Unable to find package 'Clide 220.127.116.11'
At C:\Temp\ConsoleApplication1\packages\Clide.18.104.22.168\tools\init.ps1:17 char:18
+ Update-Package <<<< $package -Project $name
+ CategoryInfo : NotSpecified: (:) [Update-Package], InvalidOperationException
+ FullyQualifiedErrorId : NuGet.VisualStudio.Cmdlets.UpdatePackageCmdlet
Which is incorrect as the package does exist! (I've just installed in that solution!).
Any ideas? (I've assembled that script from another email thread)
Daniel Cazzulino | Developer Lead | MS MVP | Clarius Consulting | +1 425.329.3471