我已经创建了一个用于在C#(控制台应用程序)中测试Web应用程序的框架所有软件包均由Nuget软件包管理器管理。当我尝试通过nuget install / uninstall软件包时,我遇到了异常(末尾粘贴)。
工具/配置
让我知道是否有人需要其他详细信息。我查看了与Nuget相关的线程,但是没有找到任何有用的线程,这些线程都可以提供一些想法或解决方案。
让我知道您是否需要其他信息||请提出一些想法/解决方案Exception
PM> '5.0.0+42a8779499c1d1ed2488c2e6b9e2ee6ff6107766' is not a valid version string.
Parameter name: version
At line:1 char:50
+ '5.0.0+42a8779499c1d1ed2488c2e6b9e2ee6ff6107766' is not a valid versi ...
+ ~~
Unexpected token 'is' in expression or statement.
PM>
PM> Install-Package NuGet.Frameworks -Version 4.7.0
Install-Package : '5.0.0+42a8779499c1d1ed2488c2e6b9e2ee6ff6107766' is not a valid version string.
Parameter name: version
At line:1 char:1
+ Install-Package NuGet.Frameworks -Version 4.7.0
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], ArgumentException
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackag
eCommand
PM> uninstall-package Microsoft.TestPlatform.TranslationLayer -version 16.6.1
uninstall-package : '5.0.0+42a8779499c1d1ed2488c2e6b9e2ee6ff6107766' is not a valid version string.
Parameter name: version
At line:1 char:1
+ uninstall-package Microsoft.TestPlatform.TranslationLayer -version 16 ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Uninstall-Package], ArgumentException
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.UninstallPack
ageCommand
PM> nuget update -self
nuget : The term 'nuget' is not recognized as the name of a cmdlet, function, script file, or
operable program. Check the spelling of the name, or if a path was included, verify that the path
is correct and try again.
At line:1 char:1
+ nuget update -self
+ ~~~~~
+ CategoryInfo : ObjectNotFound: (nuget:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
屏幕截图
您要还原的软件包使用SemVer 2.0版本控制(此处通过+
向我们表示,其后是构建元数据)。不幸的是,Visual Studio 2013附带的程序包管理器不支持SemVer 2.0。 VS2017 15.3+(和带有特殊扩展名的VS2015)仅本地支持它。
从Nuget Package Versioning文档中的Semantic Versioning 2.0.0
部分(地雷处):
如果将特定于SemVer v2.0.0的程序包上传到nuget.org,则软件包对较旧的客户不可见,并且仅对以下NuGet客户:
- 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 +)