close
.NETDevOps

Nuget 2.7 Error – Input string was not in a correct format

no thumb

Nuget 2.7 Error – Input string was not in a correct format

Input string was not in a correct format.I recently installed a fresh copy of Visual Studio 2013 with Nuget 2.7. Shortly afterward I began installing a few Packages, which appeared to occur without a problem. It wasn’t until I began coding against those libraries that I noticed something wasn’t right. The libraries did not show under references although they showed up under Nuget Package Manager. I tried removing the Packages which generated the following error.

Installing 'TopShelf 3.1.2'. 
Successfully installed 'TopShelf 3.1.2'. 
Adding 'log4net 2.0.0' to Cogs.Server. 
Install failed. Rolling back... 
install-package : Input string was not in a correct format. 
At line:1 char:1
install-package topshelf
~~~~~~~~~~~~~~~~~~~~~~~
CategoryInfo : NotSpecified: (:) [Install-Package], FormatException
FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand

Apparently this is a known bug in Nuget 2.7. The solutions I found were either to uninstall 2.7 and install a previous version, or run the following command to register a COM object.

regsvr32 "C:\Program Files (x86)\Common Files\microsoft shared\MSEnv\VsLangproj.olb"

While manually registering a COM object doesn’t seem the cleanest fix, it does seem to fix it. After running this I no longer had any issues installing/uninstalling Packages. I also had been getting sporadic Visual Studio crashes when the Nuget Package Manager screen was open, and those went away as well.

One footnote, I had to go back and manually clean up the Packages I had installed prior, but had not fully installed. What I did was open the packages.config for each project and remove the existing Package reference, then reinstall the Package. After that everything seemed to work as expected.

 

Byron Pate

The author Byron Pate