繁体   English   中英

'4.6.0-preview6.19303.8' 不是有效的版本字符串。 无法在 Visual Studio 2013 中安装 Nuget 包

[英]'4.6.0-preview6.19303.8' is not a valid version string. Unable to Install Nuget Packages in Visual Studio 2013

通常我在 .NET 4.5 上工作,我的同事在他的机器上安装了 .NET 4.6.2,给了我项目让我做更改。

在 Nuget 控制台中,显示以下错误“4.6.0-preview6.19303.8”不是有效的版本字符串。

我正在努力更新 Nuget 软件包,它显示以下错误,这是什么意思..

PM> Install-Package Microsoft.Owin.Host.SystemWeb -Version 4.1.0
Attempting to resolve dependency 'Owin (≥ 1.0.0)'.
Attempting to resolve dependency 'Microsoft.Owin (≥ 4.1.0)'.
Installing 'Microsoft.Owin 4.1.0'.
You are downloading Microsoft.Owin from Microsoft, the license agreement to which is available at https://raw.githubusercontent.com/aspnet/AspNetKatana/v4.0.1/LICENSE.txt. Check the package for additional dependencies, which may come with their own license agreement(s). Your use of the package and dependencies constitutes your acceptance of their license agreements. If you do not accept the license agreement(s), then delete the relevant components from your device.
Successfully installed 'Microsoft.Owin 4.1.0'.
Installing 'Microsoft.Owin.Host.SystemWeb 4.1.0'.
You are downloading Microsoft.Owin.Host.SystemWeb from Microsoft, the license agreement to which is available at https://raw.githubusercontent.com/aspnet/AspNetKatana/v4.0.1/LICENSE.txt. Check the package for additional dependencies, which may come with their own license agreement(s). Your use of the package and dependencies constitutes your acceptance of their license agreements. If you do not accept the license agreement(s), then delete the relevant components from your device.
Successfully installed 'Microsoft.Owin.Host.SystemWeb 4.1.0'.
Install failed. Rolling back...
Install-Package : '4.6.0-preview6.19303.8' is not a valid version string.
At line:1 char:1
+ Install-Package Microsoft.Owin.Host.SystemWeb -Version 4.1.0
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], ArgumentException
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand

任何帮助将不胜感激。 谢谢:)

Nuget 更新后,了解 Nuget 是最新的

PM> nuget update -self
Checking for updates from https://api.nuget.org/v3/index.json.
  CACHE https://api.nuget.org/v3/registration5-gz-semver2/nuget.commandline/index.json
Currently running NuGet.exe 5.5.1.
NuGet.exe is up to date.
Update successful.

看起来它与 nuget 版本有关,如文档中所述:

NuGet 4.3.0+ 支持 SemVer 2.0.0,它支持带点符号的预发布编号,如 1.0.1-build.23。 4.3.0 之前的 NuGet 版本不支持点表示法。 您可以使用 1.0.1-build23 之类的表单。

在您的情况下, 4.6.0-preview6.19303.8是“带有点符号的预发布编号”(“preview6”和“19303”之间的“.”)。

You can check the nuget version you're using by typing nuget help in the Package Manager Console of Visual Studio, then update it with nuget update -self

此外,Visual Studio 的版本似乎也有限制:

旧客户端不支持 SemVer v2.0.0 的某些语义。 如果以下任一陈述为真,则 NuGet 认为 package 版本特定于 SemVer v2.0.0:

  • 预发行版 label 以点分隔,例如 1.0.0-alpha.1

If you upload a SemVer v2.0.0-specific package to nuget.org, the package is invisible to older clients and available to only the following NuGet clients:

  • NuGet 4.3.0+
  • Visual Studio 2017 版本 15.3+
  • 带有 NuGet VSIX v3.6.0 的 Visual Studio 2015
  • dotnet dotnetcore.exe (.NET SDK 2.0.0+)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM