1

I have created a framework for testing web applications in C#(Console application) All the packages are managed by Nuget package manager. When I try to install/uninstall packages via nuget, I'm facing exception(pasted at the end).

Tools/Configurations

  1. Visual studio - Community 2013
  2. .NET Framework - 4.5.2 Selenium
  3. webdriver - 3.141.0
  4. MSBuild.NUnit version="1.0.2"
  5. NUnit version="3.12.0"
  6. NUnit3TestAdapter version="3.15.1" NU
  7. NUnitTestAdapter version="2.2.0"

Let me know if any one need any other details. I looked threads related to Nuget, but didn't found any helpful thread that any give some idea or solution.

Let me know if you need any other information || Please suggest some ideas/solutions 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

Screenshots

NugetPackageManagerErrorScreenshot

Installed Nuget

  • What do you get when you install/uninstall through `Project-->Manage Nuget Packages` ( VS for mac) – user1207289 May 25 '20 at 17:21
  • 1 - I get this issue when I try to install/uninstall packages via UI : [link](https://i.stack.imgur.com/bywJN.png) 2 - Getting same error via package manager console(pasted in the thread). Using Windows 10 OS. – Vishal kashyap May 25 '20 at 17:30
  • The package manager included with VS 2013 doesn't support Semver 2.0 packages. Only 2015+. You won't be able to install thy version – pinkfloydx33 May 25 '20 at 18:30

2 Answers2

0

The package you are trying to restore (or in this case, one of its dependencies) uses SemVer 2.0.0 Versioning which is indicated to us here by the + followed by build meta data in the version number.

Unfortunately, the package manager included with Visual Studio 2013 does not support SemVer 2.0.0. It is only natively supported by VS2017 15.3+ (and VS2015 with a special extension). Packages using Semantic Versioning 2.0.0 will be in effect hidden from older clients, such as VS 2013.*

From the Nuget Package Versioning documentation, under the section Semantic Versioning 2.0.0 (bolding mine):

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 version 15.3+
  • Visual Studio 2015 with NuGet VSIX v3.6.0
  • dotnet
    • dotnetcore.exe (.NET SDK 2.0.0+)

As a workaround, you may download a newer version of the nuget command line tool and then execute nuget restore against your project from the command line manually.

Note that more and more packages are switching to Semantic Versioning 2.0.0. You may start running into this issue increasingly often depending on the packages you are using. I'd suggest upgrading your version of Visual Studio if at all possible (VS Community is free).

* There is a somewhat annoying warning message emitted by later tooling (such as dotnet push and nuget push) that alerts the author to the fact their package is using SemVer 2.0.0 and will be unusable by older clients. The package authors in this case are either oblivious to this fact or have determined that the benefits of the versioning scheme outweigh the potential loss of package consumers.

pinkfloydx33
  • 11,863
  • 3
  • 46
  • 63
0

Somehow I managed to get the install/uninstall package working via Package manager console.

I had tried these steps earlier, but not sure why it didn't worked then.

  1. Un-installed nuget : Tools > Extensions & updates > Installed > Nuget
  2. Re-installed nuget : Tools > Extensions & updates > Online[Visual Studio Gallery] > Nuget > Install
  3. Changed package manager settings : Tools > Nuget Package Manager > Package manager settings > Nuget Package manager > Package sources > Checked only "nuget.org", rest everthing was unchecked > Click "Ok".
  4. Restart the VS 2013(restart your system, if you want.)

Install/Uninstall via package manager console screenshot

Edit 1 : Able to see via UI as well. Able to see via UI as well