NuGet Package Manager Console: "update-package -project ..." does not update all installed packages

I have a package configuration in ProjectX as follows:

<?xml version="1.0" encoding="utf-8"?> <packages> <package id="Castle.Core" version="2.5.2" /> <package id="Castle.Windsor" version="2.5.3" /> <package id="CommonServiceLocator" version="1.0" /> <package id="MyCompany.Enum" version="1.1.0.11" /> <package id="MyCompany.Common" version="1.1.0.9" /> <package id="MyCompany.Castle.Installers" version="1.1.0.13" /> </packages> 

When I issue the following command in the package management console:

 update-package -project ProjectX 

I see the following output:

 No updates available for 'MyCompany.Castle.Installers'. No updates available for 'CommonServiceLocator'. No updates available for 'Castle.Windsor'. No updates available for 'Castle.Core'. 

I know that there is a new MyCompany.Enum , so why is it not listed in the output? I know that NuGet is trying to use the lowest suitable version during installation, but in this case I want update-package to update-package it to the latest version.

I tried to get it to update MyCompany.Enum with the following command:

 update-package -project MyCompany.Services.MyService MyCompany.Enum 

And this time an error message appeared:

 Update-Package : Unable to find package 'MyCompany.Enum' in 'MyCompany.Services.MyService'. At line:1 char:15 + update-package <<<< -project MyCompany.Services.ProjectX MyCompany.enum + CategoryInfo : NotSpecified: (:) [Update-Package], InvalidOperationException + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.UpdatePackageCommand 

This is very strange, because MyCompany.Enum displayed both in packages.config and references ProjectX in the solution explorer.

What could be the explanation for this? If this is a nugget error, fine, but I expect that I misunderstand how this works. I heard about such strange events with repositories.config , but could not connect any of these problems with what I see here.

Thank you very much in advance.

UPDATE
If I manually installed the MyCompany.Enum package on ProjectX using the following command:

 install-package -project ProjectX MyCompany.Enum 

Then I get this output:

 'MyCompany.Enum 1.5.0.1' already installed. Successfully added 'MyCompany.Enum 1.5.0.1' to MyCompany.Services.ProjectX. 

But unfortunately, now I have two instances of MyCompany.Enum in my packages.config file:

 <?xml version="1.0" encoding="utf-8"?> <packages> <package id="Castle.Core" version="2.5.2" /> <package id="Castle.Windsor" version="2.5.3" /> <package id="CommonServiceLocator" version="1.0" /> <package id="MyCompany.Enum" version="1.1.0.11" /> <package id="MyCompany.Common" version="1.1.0.9" /> <package id="MyCompany.Castle.Installers" version="1.1.0.13" /> <package id="MyCompany.Enum" version="1.5.0.1" /> </packages> 
+4
source share
1 answer

Is your packages\repositories.config real and correct?

Since most people do not check the package folder, the file is lost. Some NuGet teams first look there and fail. Some actions (for example, installing a package in a project) will lead to its regeneration.

I had a very similar problem when the updates did not work, but as soon as I added a new project, they started working correctly.

+2
source

All Articles