Install Nuget Package error "The path is not of a legal form"

Had the same problem with the packages below, updated NuGet via "Tools -> Extensions and Updates -> Updates" to v.3.1.1.0 and now everything works again. Thanks!

Microsoft.Bcl

Google.Apis.Calendar.v3

RazorEngine

Sample error so more people can find this thread:

"Install-Package : The path is not of a legal form. At line:1 char:16 + Install-Package <<<< RazorEngine + CategoryInfo : NotSpecified: (:) [Install-Package], Exception + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand"


Had a same problem with my VS 2015, I just added the reference via nuget by opening the same solution in VS 2013 and then reopened it back in VS 2015 for usual work.


Edit: If you have NuGet 3.0, then that's the problem. Just update NuGet and everything should work. The steps below apply to NuGet 3.0, which are painful and error prone. Don't go through such pain, choose the easy step, update your Nuget!

I updated to VS Express 2015 and since then i've been through some adventures.

TL;DR if you "disable" TFS (source control), you should be able to install the package. Then add the solution to source control again, but it caused me tons of problems.

So...

I see you have TFS. I have it too.

Also, I see you are getting the same error messages as me.

I tried to install LanguageExt (an awesome library for C# 6) and it failed when it tried to install one of its dependencies (System.Collections.Immutable).

If you want to go through all this things, please make a backup of your project folder.

This is what I did:

1 - Copied my solution folder to somewhere else.

2 - Opened the solution. VS smartly asked me to add it to source control, but I didn't want to.

3 - Tried to Install-Package LanguageExt

4 - Unexpected success!

5 - "Fine, let me just add it to the TFS source control again"

Here my journey started.

Since I have little experience with TFS, I got thousands and thousands of conflicts, files vanishing and appearing again, etc.

But after some work, I got it running.

And it was worth it.

But the solution isn't large, so, it was easy.