Re: Updating all pacakges in a solution

Jan 4, 2011 at 8:35 PM
any pointers? I could really use a tip or something :(

/kzu

--
Daniel Cazzulino | Developer Lead | MS MVP | Clarius Consulting | +1 425.329.3471


On Mon, Jan 3, 2011 at 13:30, Daniel Cazzulino <kzu@clariusconsulting.net> wrote:
Hi guys,
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.

function global:Update-Packages
{
$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:

PM> update-packages
Update-Package : Unable to find package 'Clide 1.0.0.2'
At C:\Temp\ConsoleApplication1\packages\Clide.1.0.0.2\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)

/kzu

--
Daniel Cazzulino | Developer Lead | MS MVP | Clarius Consulting | +1 425.329.3471

Coordinator
Jan 4, 2011 at 9:41 PM

We're thinking about it. :)

Developer
Jan 6, 2011 at 6:04 PM

That logic seems lime it should work  but maybe there is a small logic bug somewhere.