Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nuget fails to install specific version

Tags:

nuget

I was able to set up my own NuGet server (as described here). The server Packages folder contains several versions of MyPackage, say 1.0.8.0 and 1.0.9.0. When I install it in a default way (with no version specified), it gets installed successfully. But when I explicitly do

Install-Package MyPackage -Version 1.0.9.0

it goes wrong with the following message:

Install-Package : Unable to find version '1.0.9.0' of package 'MyPackage'. At line:1 char:16 + install-package <<<< MyPackage -Version 1.0.9.0 + CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand

UPDATE: This error message appears when Package Source in Package Manager Console is set to "ALL". When I set it to my own source (where, in fact, the package is expected to be found), another error appears:

Install-Package : **There are multiple root elements. Line 42, position 2.**
At line:1 char:16
+ install-package <<<<  dfct.shell.core.contracts -Version "1.0.8.0"
+ CategoryInfo          : NotSpecified: (:) [Install-Package], XmlException
+  FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand

Multiple root elements, Line 42? In what file? Why is that? I think there's something wrong on the server side, but can't figure out what it is.

like image 478
Dmitry Arestov Avatar asked May 19 '26 20:05

Dmitry Arestov


1 Answers

Turned out that coexistence of both MyPackage.1.0.9.0.nupkg and MyPackage.1.0.9.0.symbols.nupkg caused NuGet to crash. NuGet uses OData as transport and somewhere deep in OData it could not serialize/deserialize two packages, complaining about "multiple root nodes". So I simply removed -symbols from nuget pack command line thus disabling debug packages generation, and now it all works fine.

like image 51
Dmitry Arestov Avatar answered May 23 '26 21:05

Dmitry Arestov