Nuget无法安装特定版本 [英] Nuget fails to install specific version

查看:57
本文介绍了Nuget无法安装特定版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我能够设置自己的 NuGet 服务器(如 这里).服务器 Packages 文件夹包含多个版本的 MyPackage,例如 1.0.8.0 和 1.0.9.0.当我以默认方式(未指定版本)安装它时,它会成功安装.但是当我明确地做

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

以下消息出错:

安装包:无法找到包MyPackage"的版本1.0.9.0".在行:1 字符:16+ 安装包 <<<<MyPackage - 版本 1.0.9.0+ CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException+ FullQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand

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

更新:当包管理器控制台中的 Package Source 设置为ALL"时,会出现此错误消息.当我将它设置为我自己的源时(实际上,该包应该在那里找到),出现另一个错误:

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

多个根元素,第 42 行?在什么文件里?这是为什么?我认为服务器端有问题,但无法弄清楚是什么.

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.

推荐答案

原来 MyPackage.1.0.9.0.nupkgMyPackage.1.0.9.0.symbols.nupkg 共存 导致 NuGet 崩溃.NuGet 使用 OData 作为传输,并且在 OData 深处的某个地方它无法序列化/反序列化两个包,抱怨多个根节点".所以我简单地从 nuget pack 命令行中删除了 -symbols 从而禁用调试包生成,现在一切正常.

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.

这篇关于Nuget无法安装特定版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆